# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
374425 |
2021-03-07T09:40:05 Z |
VEGAnn |
Euklid (COCI20_euklid) |
C++14 |
|
1 ms |
364 KB |
#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
// cerr << R(36, 130) << '\n';
// cerr << R(38, 137) << '\n';
// cerr << R(26, 91) << '\n';
// cerr << R(28, 98) << '\n';
// cerr << R(40, 120) << '\n';
//
// return 0;
int qq; cin >> qq;
for (; qq; qq--){
cin >> g >> h;
if (h <= g){
if (R(g, h * g) == h){
cout << g << " " << h * g << '\n';
}
for (ll i = g + g; ; i += g)
if (R(i, i * h + g) == h) {
cout << i << " " << i * h + g << '\n';
break;
}
continue;
}
ll beg = g * ((h + g - 1) / g);
for (ll i = 1; ; i++)
if (__gcd(beg, i) == g && R(i, beg) == h){
cout << beg << " " << i << '\n';
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |