/*
* author: Araragi
*/
// 3
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
//using namespace __gnu_pbds;
//typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll R(ll a, ll b)
{
if (a < b)
return R(b, a);
else if (a >= b && b > 1)
return R(ll(a / b), b);
else if (a >= b && b == 1)
return a;
}
int main()
{
//ifstream cin("vacation.in");
//ofstream cout("vacation.out");
int tt;
cin >> tt;
while (tt--)
{
ll x, y;
cin >> x >> y;
bool fnd = 0;
for (ll i = 1; i <= ll(1e3); i++)
{
if (fnd)
break;
for (ll j = 1; j <= ll(1e3); j++)
if (__gcd(i, j) == x && R(i, j) == y)
{
cout << i << " " << j << '\n';
fnd = 1;
break;
}
}
}
}
Compilation message
euklid.cpp: In function 'll R(ll, ll)':
euklid.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
27 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
364 KB |
Output is correct |
2 |
Execution timed out |
1090 ms |
364 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
364 KB |
Output is correct |
2 |
Correct |
148 ms |
364 KB |
Output is correct |
3 |
Execution timed out |
1078 ms |
364 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1045 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
364 KB |
Output is correct |
2 |
Correct |
10 ms |
372 KB |
Output is correct |
3 |
Correct |
10 ms |
364 KB |
Output is correct |
4 |
Correct |
12 ms |
364 KB |
Output is correct |
5 |
Correct |
13 ms |
364 KB |
Output is correct |
6 |
Correct |
16 ms |
364 KB |
Output is correct |
7 |
Correct |
19 ms |
364 KB |
Output is correct |
8 |
Correct |
23 ms |
364 KB |
Output is correct |
9 |
Correct |
26 ms |
364 KB |
Output is correct |
10 |
Incorrect |
68 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
364 KB |
Output is correct |
2 |
Correct |
10 ms |
372 KB |
Output is correct |
3 |
Correct |
10 ms |
364 KB |
Output is correct |
4 |
Correct |
12 ms |
364 KB |
Output is correct |
5 |
Correct |
13 ms |
364 KB |
Output is correct |
6 |
Correct |
16 ms |
364 KB |
Output is correct |
7 |
Correct |
19 ms |
364 KB |
Output is correct |
8 |
Correct |
23 ms |
364 KB |
Output is correct |
9 |
Correct |
26 ms |
364 KB |
Output is correct |
10 |
Incorrect |
68 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
364 KB |
Output is correct |
2 |
Execution timed out |
1090 ms |
364 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |