답안 #473821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473821 2021-09-16T09:50:18 Z Ahmed_Solyman Euklid (COCI20_euklid) C++14
0 / 110
313 ms 524292 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll R(ll a,ll b){
    if(a>b)R(b,a);
    else if(a>=b>1)R(a/b,b);
    else if(a>=b==1)a;
}
int main()
{
    ll t;cin>>t;
    while(t--){
        ll g,h;cin>>g>>h;
        for(ll i=0;i<=max(h,g);i++){
            bool b=0;
            for(ll j=0;j<=max(h,g);j++){
                if(__gcd(i,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:9:17: warning: comparison of constant '1' with boolean expression is always false [-Wbool-compare]
    9 |     else if(a>=b>1)R(a/b,b);
      |             ~~~~^~
euklid.cpp:9:14: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
    9 |     else if(a>=b>1)R(a/b,b);
      |             ~^~~
euklid.cpp:10:14: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   10 |     else if(a>=b==1)a;
      |             ~^~~
euklid.cpp:10:21: warning: statement has no effect [-Wunused-value]
   10 |     else if(a>=b==1)a;
      |                     ^
euklid.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
   11 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 313 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 313 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 307 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 312 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 312 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 313 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -