# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
473908 | Ahmed_Solyman | Euklid (COCI20_euklid) | C++14 | 1 ms | 332 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 && b>1)return R(a/b,b);
if(a>=b && b==1)return a;
}
int main()
{
ll t=1;cin>>t;
while(t--){
ll a,b;cin>>a>>b;
if(a==b || b==2 || a==b*b)cout<<a*b<<" "<<a<<endl;
else{
for(ll i=0;i<=2000;i++){
bool b=0;
for(ll j=0;j<=2000;j++){
if(R(i,j)==b && __gcd(i,j)==a){
cout<<i<<" "<<j<<endl;b=1;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... |