fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int t;
  7. cin >> t;
  8. while (t-- >0) {
  9. long long candies;
  10. long long remidner = 0;
  11. long long n;
  12. cin >> n;
  13. for (long long i = 0; i < n; i++) {
  14. cin >> candies;
  15. remidner = (remidner + candies) % n; cout<<remidner<<endl;
  16. }
  17. if (remidner == 0) cout << "YES" << endl;
  18. else cout << "NO" << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 3344KB
stdin
2

5
5
2
7
3
8

6
7
11
2
7
3
4
stdout
0
2
4
2
0
YES
1
0
2
3
0
4
NO