Submission #473916

# Submission time Handle Problem Language Result Execution time Memory
473916 2021-09-16T11:53:05 Z Ahmed_Solyman Euklid (COCI20_euklid) C++14
35 / 110
670 ms 268 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<=2000;i++){
                bool v=0;
                for(ll j=1;j<=2000;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 | }
      | ^
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 0 ms 204 KB Output is correct
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 11 ms 204 KB Output is correct
2 Correct 22 ms 204 KB Output is correct
3 Correct 24 ms 204 KB Output is correct
4 Correct 28 ms 204 KB Output is correct
5 Correct 28 ms 204 KB Output is correct
6 Correct 33 ms 204 KB Output is correct
7 Correct 36 ms 204 KB Output is correct
8 Correct 42 ms 204 KB Output is correct
9 Correct 47 ms 204 KB Output is correct
10 Correct 55 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 204 KB Output is correct
2 Correct 22 ms 204 KB Output is correct
3 Correct 24 ms 204 KB Output is correct
4 Correct 28 ms 204 KB Output is correct
5 Correct 28 ms 204 KB Output is correct
6 Correct 33 ms 204 KB Output is correct
7 Correct 36 ms 204 KB Output is correct
8 Correct 42 ms 204 KB Output is correct
9 Correct 47 ms 204 KB Output is correct
10 Correct 55 ms 204 KB Output is correct
11 Incorrect 670 ms 268 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 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 0 ms 204 KB Output is correct
15 Correct 0 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 11 ms 204 KB Output is correct
24 Correct 22 ms 204 KB Output is correct
25 Correct 24 ms 204 KB Output is correct
26 Correct 28 ms 204 KB Output is correct
27 Correct 28 ms 204 KB Output is correct
28 Correct 33 ms 204 KB Output is correct
29 Correct 36 ms 204 KB Output is correct
30 Correct 42 ms 204 KB Output is correct
31 Correct 47 ms 204 KB Output is correct
32 Correct 55 ms 204 KB Output is correct
33 Incorrect 670 ms 268 KB Output isn't correct
34 Halted 0 ms 0 KB -