Guest User

Untitled

a guest
Mar 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7. long int n;
  8. long int i;
  9. cin >> n;
  10. long int a[n];
  11.  
  12.  
  13. for( i=0;i<n;i++)
  14. {
  15. cin>>a[i];
  16.  
  17. }
  18. for(i=0;i<n;i++)
  19. {
  20. a[a[i]%n]+=n;
  21.  
  22. }
  23. long int max=a[0],result=0;
  24. for(i=1;i<n;i++)
  25. {
  26. if(a[i]/n>max)
  27. {
  28. max=a[i]/n;
  29. result=i;
  30. }
  31.  
  32.  
  33.  
  34. }
  35.  
  36.  
  37. cout<<result;
  38.  
  39. return 0;
  40. }
Add Comment
Please, Sign In to add comment