이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
* 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;
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
euklid.cpp: In function 'll R(ll, ll)':
euklid.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
27 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |