# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
473918 | Ahmed57 | Euklid (COCI20_euklid) | C++14 | 1097 ms | 35660 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int dp[3001][3001];
long long r(long long a,long long b){
if(dp[a][b]!=-1)return dp[a][b];
if(a<b)return dp[a][b]= r(b,a);
else if(a>=b&&b>1)return dp[a][b]=r(abs(a/b),b);
else if(a>=b&&b==1)return dp[a][b]=a;
}
int main(){
//ios_base::sync_with_stdio(false);cin.tie(NULL);
memset(dp,-1,sizeof dp);
int t;cin>>t;
z:while(t--){
long long a,b;
cin>>a>>b;
if(a==b||b==2||a==b*b){
cout<<a*b<<" "<<a<<"\n";goto z;
}
for(int i = 1;i<=3000;i++){
for(int j = 1;j<=3000;j++){
if(__gcd(i,j)==a&&r(i,j)==b){
cout<<i<<" "<<j<<"\n";
goto z;
}
}
}
}
return 0;
}
컴파일 시 표준 에러 (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... |