이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll a,b;
ll edicul(ll x,ll y){
if(y > x)swap(x , y);
if(y == 1)return x;
return edicul(x / y , y);
}
int main(){
ios::sync_with_stdio(false);
ll q;
cin >> q;
while(q--){
cin >> a >> b;
ll l = b,r = 2*b*b;
while(r <= 1000000){
l = l * b;
r = r * b;
}
r--;
while(r%a)r--;
ll x = ((b * r - 1) / a + 1)* a;
while(__gcd(x , r) != a)x += a;
//cout << edicul(x , r) << '\n';
cout << x << " " << r << '\n';
}
return 0;
}
# | 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... |