Submission #334635

# Submission time Handle Problem Language Result Execution time Memory
334635 2020-12-09T15:33:56 Z achibasadzishvili Euklid (COCI20_euklid) C++14
0 / 110
1 ms 364 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll a,b;
ll edicul(ll x,ll y){
    if(y > x)swap(x , y);
    if(y == 1)return x;
    return edicul(x / y , y);
}
int main(){
    ios::sync_with_stdio(false);
    ll q;
    cin >> q;
    while(q--){
        cin >> a >> b;
        ll l = b,r = 2*b*b;
        while(r <= 1000000){
            l = l * b;
            r = r * b;
        }
        
        r--;
        while(r%a)r--;
        
        ll x = ((b * r - 1) / a + 1)* a;
        
        while(__gcd(x , r) != a)x += a;
        
        cout << edicul(x , r) << '\n';
        cout << x << " " << r << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -