-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path거스름돈.java
More file actions
30 lines (25 loc) · 745 Bytes
/
거스름돈.java
File metadata and controls
30 lines (25 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int cnt = 0;
while (true) {
if (n % 5 == 0) {
cnt += n / 5;
System.out.println(cnt);
break;
} else {
n -= 2;
cnt++;
}
if (n < 0) {
System.out.println(-1);
break;
}
}
}
}