Submission #445907

#TimeUsernameProblemLanguageResultExecution timeMemory
445907JasiekstrzEuklid (COCI20_euklid)C++17
110 / 110
1 ms312 KiB
#include<bits/stdc++.h> #define fi first #define se second using namespace std; void solve() { long long g,h; cin>>g>>h; long long x; for(long long l=1,r=2;true;l*=h,r*=h) { x=((l-1)/g+1)*g; x=max(x,2*g); if(x<r) break; } x/=g; long long a=x*h+1; cout<<g*a<<" "<<g*x<<"\n"; return; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int qq; cin>>qq; while(qq--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...