새소식

Algorithm/Acmicpc.net (백준)

[C언어] 백준 : 사탕 선생 고창영 (2547번)

  • -
#include <stdio.h>
int main()
{
    int t, n;
    long long int candy;
    scanf("%d", &t);
    for (int i = 0; i < t; i++) {
        long long int total = 0;
        scanf("%d", &n);
        for (int j = 0; j < n; j++) {
            scanf("%lld", &candy);
            total += candy;
            total = total % n;
        }
        if (total == 0) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
    return 0;
}
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.