Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define times(I, X) for (int I=0; I<X; I++)
  4. #define rtimes(I, X) for(int I=X; I>=0; I--)
  5.  
  6. #ifdef DEBUG
  7. #define dump(X) std::cout << __LINE__ << "L: [" << #X << "] = [" << X << "]\n"
  8. #else
  9. #define dump(X)
  10. #endif
  11. #define pb push_back
  12. #define int long long
  13. #define ll long long
  14. #define fi first
  15. #define se second
  16.  
  17. using namespace std;
  18. const int SZE = 1e3 + 5;
  19. const int MOD = 1e9 + 7;
  20.  
  21.  
  22.  
  23. signed main() {
  24. #ifndef DEBUG
  25. ios_base::sync_with_stdio(0);
  26. cin.tie(0);
  27. cout.tie(0);
  28. // freopen("test.txt", "r", stdin);
  29. // freopen("result.txt", "w", stdout);
  30. #endif
  31. int n; cin >> n;
  32. vector<int> mas(1000, 0);
  33. int cnt = 0;
  34. for(int i = 0; i < n; i++)
  35. {
  36. int a, b;
  37. cin >> a >> b;
  38. int c = __gcd(a, b);
  39. mas[c - 1]++;
  40. if(mas[c -1] > cnt)
  41. {
  42. cnt = mas[c - 1];
  43. }
  44. }
  45. for(int i = 999; i >= 0; i--)
  46. {
  47. if(mas[i] == cnt)
  48. {
  49. cout << i + 1 << " ";
  50. }
  51. }
  52. return 0;
  53. }
  54.  
  55. /*
  56.  
  57. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement