fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <math.h>
  4. #define ll long long
  5. using namespace std;
  6.  
  7. int main() {
  8. ll int t;
  9. cin>>t;
  10. // char f;
  11. // cin>>f;
  12. while(t--){
  13. ll int p;
  14. cin>>p;
  15. ll int h=p;
  16. ll int total=0;
  17. while(p--){
  18. ll int n;
  19. cin>>n;
  20. total+=n;
  21. // cout<<total<<endl;
  22. }
  23. // cout<<total<<" "<<h<<" ";
  24. if(total%h==0) cout<<"YES"<<endl;
  25. else cout<<"NO"<<endl;
  26. }
  27. // your code goes here
  28. return 0;
  29. }
Success #stdin #stdout 0s 4204KB
stdin
2

5
5
2
7
3
8

6
7
11
2
7
3
4
stdout
YES
NO