제출 #473905

#제출 시각아이디문제언어결과실행 시간메모리
473905Ahmed_SolymanEuklid (COCI20_euklid)C++14
20 / 110
1 ms204 KiB
#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<=1000;i++){ bool b=0; for(ll j=0;j<=1000;j++){ if(R(i,j)==b && __gcd(i,j)==a){ cout<<i<<" "<<j<<endl;b=1;break; } } if(b)break; } } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

euklid.cpp: In function 'll R(ll, ll)':
euklid.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
#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...