답안 #473915

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473915 2021-09-16T11:52:39 Z Ahmed_Solyman Euklid (COCI20_euklid) C++14
35 / 110
1000 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=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=1;i<=3000;i++){
                bool v=0;
                for(ll j=1;j<=3000;j++){
                    if(R(i,j)==b && __gcd(i,j)==a){
                        cout<<i<<" "<<j<<endl;v=1;break;
                    }
                }
                if(v)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 Correct 0 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 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 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 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 204 KB Output is correct
2 Correct 35 ms 204 KB Output is correct
3 Correct 39 ms 204 KB Output is correct
4 Correct 41 ms 204 KB Output is correct
5 Correct 46 ms 204 KB Output is correct
6 Correct 53 ms 204 KB Output is correct
7 Correct 60 ms 204 KB Output is correct
8 Correct 64 ms 204 KB Output is correct
9 Correct 73 ms 204 KB Output is correct
10 Correct 87 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 204 KB Output is correct
2 Correct 35 ms 204 KB Output is correct
3 Correct 39 ms 204 KB Output is correct
4 Correct 41 ms 204 KB Output is correct
5 Correct 46 ms 204 KB Output is correct
6 Correct 53 ms 204 KB Output is correct
7 Correct 60 ms 204 KB Output is correct
8 Correct 64 ms 204 KB Output is correct
9 Correct 73 ms 204 KB Output is correct
10 Correct 87 ms 204 KB Output is correct
11 Execution timed out 1090 ms 204 KB Time limit exceeded
12 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 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 18 ms 204 KB Output is correct
24 Correct 35 ms 204 KB Output is correct
25 Correct 39 ms 204 KB Output is correct
26 Correct 41 ms 204 KB Output is correct
27 Correct 46 ms 204 KB Output is correct
28 Correct 53 ms 204 KB Output is correct
29 Correct 60 ms 204 KB Output is correct
30 Correct 64 ms 204 KB Output is correct
31 Correct 73 ms 204 KB Output is correct
32 Correct 87 ms 204 KB Output is correct
33 Execution timed out 1090 ms 204 KB Time limit exceeded
34 Halted 0 ms 0 KB -