# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
473828 | Ahmed_Solyman | Euklid (COCI20_euklid) | C++14 | 1095 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll R(ll a,ll b){
if(a<b)return R(b,a);
if(a>=b>1)return R(a/b,b);
if(a>=b==1)return a;
}
int main()
{
ll t;cin>>t;
while(t--){
ll g,h;cin>>g>>h;
if(g==h){
cout<<g<<" "<<g<<endl;
continue;
}
for(ll i=0;i<=1e18;i++){
bool b=0;
for(ll j=0;j<=1e18;j++){
if(__gcd((ll)i,(ll)j)==g && R(i,j)==h){
b=1;
cout<<i<<" "<<j<<endl;break;
}
}
if(b)break;
}
}
return 0;
}
Compilation message (stderr)
# | 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... |