Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define times(I, X) for (int I=0; I<X; I++)
- #define rtimes(I, X) for(int I=X; I>=0; I--)
- #ifdef DEBUG
- #define dump(X) std::cout << __LINE__ << "L: [" << #X << "] = [" << X << "]\n"
- #else
- #define dump(X)
- #endif
- #define pb push_back
- #define int long long
- #define ll long long
- #define fi first
- #define se second
- using namespace std;
- const int SZE = 1e3 + 5;
- const int MOD = 1e9 + 7;
- signed main() {
- #ifndef DEBUG
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- // freopen("test.txt", "r", stdin);
- // freopen("result.txt", "w", stdout);
- #endif
- int n; cin >> n;
- vector<int> mas(1000, 0);
- int cnt = 0;
- for(int i = 0; i < n; i++)
- {
- int a, b;
- cin >> a >> b;
- int c = __gcd(a, b);
- mas[c - 1]++;
- if(mas[c -1] > cnt)
- {
- cnt = mas[c - 1];
- }
- }
- for(int i = 999; i >= 0; i--)
- {
- if(mas[i] == cnt)
- {
- cout << i + 1 << " ";
- }
- }
- return 0;
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement