比赛 2025暑假集训第一场 评测结果 WWWWWWWWWWWWWWWWWWWW
题目名称 挑战 NPH 最终得分 0
用户昵称 李奇文 运行时间 0.058 s
代码语言 C++ 内存使用 3.84 MiB
提交时间 2025-06-25 09:24:05
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+5;
int t;
int n,k;
int w[N];
int main(){
	freopen("NPH.in","r",stdin);
	freopen("NPH.out","w",stdout);
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		int tj=0;
		for(int i=1;i<=n;i++){
			scanf("%d",&w[i]);
			tj+=w[i];
		}
		if(n==1){
			printf("%d\n",k*w[1]);
			continue;
		}
		if(tj==n){
			cout<<k<<endl;
		}
	}
	return 0;
}