๋ฌธ์
์ฝ๋
#include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
if(b==0) return a;
else return gcd(b,a%b);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int a,b; cin>>a>>b;
cout<<b-gcd(a,b);
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 15652๋ฒ - N๊ณผ M (4) (0) | 2021.12.04 |
---|---|
[๋ฐฑ์ค,c++] 15651๋ฒ - N๊ณผ M (3) (0) | 2021.12.04 |
[๋ฐฑ์ค,c++] 1405๋ฒ - ๋ฏธ์น ๋ก๋ด (0) | 2021.11.22 |
[๋ฐฑ์ค,c++] 15650๋ฒ - N๊ณผ M (2) (0) | 2021.11.17 |
[๋ฐฑ์ค,c++] 15649๋ฒ - N๊ณผ M(1) (0) | 2021.11.17 |
[๋ฐฑ์ค,c++] 15643๋ฒ - Yee (0) | 2021.11.17 |
๋๊ธ