이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
///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;
}
cout<<__gcd(a,b)<<" "<<R(a,b)<<endl;
}
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();
}
컴파일 시 표준 에러 (stderr) 메시지
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 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |