답안 #473833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473833 2021-09-16T10:03:30 Z Ahmed_Solyman Euklid (COCI20_euklid) C++14
4 / 110
990 ms 204 KB
#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;cin>>t;
    while(t--){
        ll g,h;cin>>g>>h;
        if(g==h){
            cout<<g<<" "<<g<<endl;
            continue;
        }
        for(ll i=0;i<=max(g,h);i++){
            bool b=0;
            for(ll j=0;j<=max(g,h);j++){
                if(__gcd((ll)i,(ll)j)==g && R(i,j)==h){
                    b=1;
                    cout<<i<<" "<<j<<endl;break;
                }
            }
            if(b)break;
        }
    }
    return 0;
}

Compilation message

euklid.cpp: In function 'll R(ll, ll)':
euklid.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 990 ms 204 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Unexpected end of file - int64 expected
7 Halted 0 ms 0 KB -