답안 #391283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
391283 2021-04-18T12:13:37 Z MrRobot_28 Euklid (COCI20_euklid) C++17
0 / 110
422 ms 324 KB
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define sz(a) (int)a.size()
#define ll long long
#define int long long
#define ld long double
const int N = 3e5 + 100;
int f(int a, int b)
{
    if(a < b)
    {
        return f(b, a);
    }
    if(b == 1)
    {
        return a;
    }
    return f(a / b, b);
}
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int g, h;
        cin >> g >> h;
        int a1, b1;
        for(int a = 1; a <= 500; a++)
        {
            for(int b = 1; b <= 500; b++)
            {
                if(__gcd(a, b) == g &&f(a, b) == h)
                {
                    a1 = a;
                    b1= b;
                }
            }
        }
        cout << a1 << " " << b1 << "\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 359 ms 324 KB Output is correct
2 Incorrect 356 ms 296 KB Integer parameter [name=a] equals to 0, violates the range [1, 10^18]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 358 ms 292 KB Output is correct
2 Correct 351 ms 204 KB Output is correct
3 Incorrect 349 ms 296 KB Integer parameter [name=a] equals to 0, violates the range [1, 10^18]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 354 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 422 ms 204 KB Output is correct
2 Correct 348 ms 300 KB Output is correct
3 Correct 341 ms 324 KB Output is correct
4 Correct 342 ms 324 KB Output is correct
5 Incorrect 337 ms 304 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 422 ms 204 KB Output is correct
2 Correct 348 ms 300 KB Output is correct
3 Correct 341 ms 324 KB Output is correct
4 Correct 342 ms 324 KB Output is correct
5 Incorrect 337 ms 304 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 359 ms 324 KB Output is correct
2 Incorrect 356 ms 296 KB Integer parameter [name=a] equals to 0, violates the range [1, 10^18]
3 Halted 0 ms 0 KB -