Submission #854461

#TimeUsernameProblemLanguageResultExecution timeMemory
854461vjudge1Euklid (COCI20_euklid)C++17
35 / 110
1084 ms600 KiB
#ifndef Local #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #endif #include <bits/stdc++.h> #define int long long #define pb push_back #define lim 100000 using namespace std; const int mod=1000000007ll; int res(int i,int j){ if(i<j)return res(j,i); if(j==1)return i; return res(i/j,j); } void solve(){ int g,h; cin>>g>>h; if(g==h){ cout<<g<<" "<<g<<"\n"; }else if(h==2){ cout<<g*2<<" "<<g<<"\n"; }else if(g==h*h){ cout<<h*h*h<<" "<<h*h<<"\n"; }else{ for(int i=1;1;i++){ for(int j=1;j<=i;j++){ if(__gcd(i,j)==g&&res(i,j)==h){ cout<<i<<" "<<j<<"\n"; return; } } } } } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #ifdef Local freopen("in","r",stdin); freopen("out","w",stdout); #endif int t=1; cin>>t; while (t--) { solve(); } }
#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...