# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448204 | Apiram | Euklid (COCI20_euklid) | C++14 | 1 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;
int64_t solve(int a,int b){
if (a==1){
return b;
}
if (b==1)return a;
if (a<b)solve(b/a,a);
else
return solve(a/b, b);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int test;cin>>test;
while(test--){
int64_t g,h;
cin>>g>>h;
vector<pair<int,int>>ans;
if (g==1){
cout<<1<<" "<<h<<endl;
continue;
}
else if (g==h){
cout<<g<<" "<<h<<endl;
continue;
}
else if (h==2){
cout<<g*2<<" "<<g<<endl;
continue;
}
else if (g==h*h){
cout<<g*h<<" "<<g<<endl;
continue;
}
else if (g%h==0){
cout<<g/h<<" "<<(g/h)*(g/h)<<endl;
}
else if (h%g==0){
cout<<h/g<<" "<<(h/g)*(h/g)<<endl;
}
else{
int64_t temp =(pow(h,5)+g-1)/g;
int64_t a = g * temp ;
int64_t b = h*a + g;
cout<<a<<" "<<b<<endl;
}
}
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... |