Submission #374388

#TimeUsernameProblemLanguageResultExecution timeMemory
374388VEGAnnEuklid (COCI20_euklid)C++14
20 / 110
1 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; const ld E = 1e-9; const int N = 2010; ll h, g; ll R(ll a, ll b){ if (b > a) return R(b, a); if (b == 1) return a; return R(a / b, b); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _LOCAL freopen("in.txt","r",stdin); #endif // _LOCAL int qq; cin >> qq; for (; qq; qq--){ cin >> g >> h; ll beg = g * ((h + g - 1) / g); for (ll i = beg; ; i += beg) if (R(i, beg) == h){ cout << beg << " " << i << '\n'; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...