Alx09

Untitled

Apr 10th, 2019
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. unsigned long long n, k , maxim = 0 , poz;
  9. cin >> n >> k;
  10. unsigned long long fr[n];
  11. for(unsigned long long i = 1; i <=n;i++) fr[i] = 0;
  12.  
  13.  
  14. for(unsigned long long i = 1; i <=k;i++)
  15. { unsigned long long a, b;
  16. cin >> a;
  17. b = ceil( (-1 + sqrt(1 + 8 * a))/2);
  18. fr[b]++;
  19. if(fr[b] > maxim)
  20. {
  21. maxim = fr[b];
  22. poz = b;
  23. }
  24.  
  25. }
  26.  
  27.  
  28.  
  29. cout << poz <<'\n' <<2*n-2;
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment