# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
448231 | Apiram | Euklid (COCI20_euklid) | C++14 | 1 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int64_t solve(int a,int b){
if (a==1){
return b;
}
if (b==1)return a;
if (a<b)solve(b/a,a);
else
return solve(a/b, b);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int test;cin>>test;
while(test--){
int64_t g,h;
cin>>g>>h;
vector<pair<int,int>>ans;
if (g==1){
cout<<1<<" "<<h<<endl;
continue;
}
else if (g==h){
cout<<g<<" "<<h<<endl;
continue;
}
else if (h==2){
cout<<g*2<<" "<<g<<endl;
continue;
}
else if (g==h*h){
cout<<g*h<<" "<<g<<endl;
continue;
}
else{
int64_t a = ((h+g-1)/g)*g;
if(g>h)a*=h;
int64_t b = h*a + g;
cout<<a<<" "<<b<<endl;
//cout<<solve(a,b)<<" "<<__gcd(a,b)<<endl;
}
}
return 0;}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |