#include<stdio.h>
int main(){
int a,st,i,j,l,sum,c,ar;
scanf("%d",&a);
for(i=0;i<a;i++){
sum=0;
scanf("%d",&st);
for(j=0;j<st;j++){
scanf("%d",&ar);
sum=(sum+ar)%st;
}
l=sum%st;
if(l==0)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
int main(){
int a,st,i,j,l,sum,c,ar;
scanf("%d",&a);
for(i=0;i<a;i++){
sum=0;
scanf("%d",&st);
for(j=0;j<st;j++){
scanf("%d",&ar);
sum=(sum+ar)%st;
}
l=sum%st;
if(l==0)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
What's wrong in my code?
ReplyDelete#include
#include
int main(){
long long int n,m,t,i,sum;
scanf("%lld",&t);
while(t--){
sum=0;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&m);
sum+=m;
}
if(sum%n==0){
printf("YES\n");
}else{
printf("NO\n");
}
}
return 0;
}