Skip to content

Commit bd91dee

Browse files
authored
[20260126] BOJ / G4 / 음식 평론가 / 이준희
1 parent b6933f0 commit bd91dee

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
```java
2+
import java.io.*;
3+
import java.util.*;
4+
5+
public class Main {
6+
public static void main(String[] args) throws Exception {
7+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8+
StringTokenizer st = new StringTokenizer(br.readLine());
9+
10+
int n = Integer.parseInt(st.nextToken());
11+
int m = Integer.parseInt(st.nextToken());
12+
13+
int res = m - gcd(n, m);
14+
15+
System.out.println(res);
16+
}
17+
18+
public static int gcd(int a, int b) {
19+
while (b != 0) {
20+
int r = a % b;
21+
a = b;
22+
b = r;
23+
}
24+
return a;
25+
}
26+
}
27+
```

0 commit comments

Comments
 (0)