-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5032.java
More file actions
57 lines (47 loc) · 1.26 KB
/
5032.java
File metadata and controls
57 lines (47 loc) · 1.26 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package algo;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
new Solution().run();
}
static class Solution {
private int e,f,c;
private BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private StringTokenizer st = null;
private StringTokenizer getStringTokenizer() throws IOException {
return new StringTokenizer(br.readLine(), " ");
}
private void input() throws IOException {
st = getStringTokenizer();
e = Integer.parseInt(st.nextToken());
f = Integer.parseInt(st.nextToken());
c = Integer.parseInt(st.nextToken());
}
private void solution() throws IOException {
int ans = 0;
int cnt = e+f;
while(true) {
if(cnt < c)
break;
ans += cnt/c;
cnt = cnt%c + cnt/c;
}
bw.write(String.valueOf(ans));
}
public void run() throws IOException {
input();
solution();
close();
}
private void close() throws IOException {
bw.close();
br.close();
}
}
}