답안 #473917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473917 2021-09-16T11:53:23 Z Ahmed_Solyman Euklid (COCI20_euklid) C++14
20 / 110
45 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<=1000;i++){
                bool v=0;
                for(ll j=1;j<=1000;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 0 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 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 204 KB Output is correct
2 Correct 11 ms 204 KB Output is correct
3 Correct 11 ms 204 KB Output is correct
4 Correct 13 ms 204 KB Output is correct
5 Correct 13 ms 204 KB Output is correct
6 Correct 15 ms 204 KB Output is correct
7 Correct 17 ms 204 KB Output is correct
8 Correct 19 ms 204 KB Output is correct
9 Correct 24 ms 204 KB Output is correct
10 Incorrect 45 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 204 KB Output is correct
2 Correct 11 ms 204 KB Output is correct
3 Correct 11 ms 204 KB Output is correct
4 Correct 13 ms 204 KB Output is correct
5 Correct 13 ms 204 KB Output is correct
6 Correct 15 ms 204 KB Output is correct
7 Correct 17 ms 204 KB Output is correct
8 Correct 19 ms 204 KB Output is correct
9 Correct 24 ms 204 KB Output is correct
10 Incorrect 45 ms 204 KB Output isn't 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 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 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 6 ms 204 KB Output is correct
24 Correct 11 ms 204 KB Output is correct
25 Correct 11 ms 204 KB Output is correct
26 Correct 13 ms 204 KB Output is correct
27 Correct 13 ms 204 KB Output is correct
28 Correct 15 ms 204 KB Output is correct
29 Correct 17 ms 204 KB Output is correct
30 Correct 19 ms 204 KB Output is correct
31 Correct 24 ms 204 KB Output is correct
32 Incorrect 45 ms 204 KB Output isn't correct