-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathskocimis.java
29 lines (28 loc) · 922 Bytes
/
skocimis.java
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
import java.io.*;
import java.util.*;
public class skocimis {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
StringTokenizer st = new StringTokenizer(in.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
int c = Integer.parseInt(st.nextToken());
int jumps = 0;
while(!(b == a + 1 && c == b + 1)) {
if(b - a > c - b) {
jumps++;
c = b;
b--;
}
else {
jumps++;
a = b;
b++;
}
//out.println(a + " " + b + " " + c);
}
out.println(jumps);
out.close();
}
}