답안 #473953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473953 2021-09-16T12:47:42 Z Mr_Ph Euklid (COCI20_euklid) C++14
16 / 110
709 ms 292 KB
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
ll R(ll a,ll b)
{
    if(a<b)
        return R(b,a);
    if(a>=b>1)
        return R(a/b,b);
    if(a>=b==1)
        return a;
}
void solve()
{
    ll a,b;
    cin>>a>>b;
    if(b==2)
    {
        cout<<a*2<<" "<<a<<endl;
        return;
    }
    else if(a==b*b)
    {
        cout<<a*b<<" "<<a<<endl;
        return;
    }
    for(int i=1; i<=3000; i++)
    {
        for(int k=1; k<=3000; k++)
        {
            if(R(i,k)==b&&__gcd(i,k)==a)
            {
                cout<<i<<" "<<k<<endl;
                return;
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    //freopen("window.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;//int st;
    cin>>t;//cin>>st;
    while(t--)
        solve();
}

Compilation message

euklid.cpp: In function 'll R(ll, ll)':
euklid.cpp:27:12: warning: comparison of constant '1' with boolean expression is always false [-Wbool-compare]
   27 |     if(a>=b>1)
      |        ~~~~^~
euklid.cpp:27:9: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
   27 |     if(a>=b>1)
      |        ~^~~
euklid.cpp:29:9: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   29 |     if(a>=b==1)
      |        ~^~~
euklid.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 204 KB Output is correct
2 Incorrect 709 ms 204 KB Unexpected end of file - int64 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 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
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 0 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 150 ms 292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 150 ms 292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 204 KB Output is correct
2 Incorrect 709 ms 204 KB Unexpected end of file - int64 expected
3 Halted 0 ms 0 KB -