problemcutter

导航

SPOJ Problem 2148:Candy III

和I一样水,只不过要注意的是输入数据会特别大,所以应该先取模再相加。

#include<cstdio>
long long  n,s,t,x,i;
int main(){
    scanf("%lld",&n);
    while(n--){
        s=0;
        scanf("%lld",&t);
        for (i=1;i<=t;i++){
            scanf("%lld",&x);
            s=(s+x%t)%t;
        }    
    if (s)printf("NO\n");else printf("YES\n");
    }
}

 

posted on 2015-03-05 17:26  problemcutter  阅读(109)  评论(0)    收藏  举报