-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathP276.java
71 lines (57 loc) · 1.79 KB
/
P276.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
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
276. Andrew's Troubles
time limit per test: 0.25 sec.
memory limit per test: 65536 KB
input: standard
output: standard
Famous Berland ACM-ICPC team Anisovka consists of three programmers: Andrew,
Michael and Ilya. A long time ago, during the first few months the team was
founded, Andrew was very often late to the trainings and contests. To stimulate
Andrew to be more punctual, Ilya and Andrew decided to introduce a new rule for
team participants. If somebody is late (i.e. comes at least one second after
appointed time) he owes a cup of tea to other team members. If he is late for 5
minutes, he owes two cups of tea. If he is late for 15 minutes, he owes three
cups of tea. And if he is late for 30 minutes or more, he owes 4 cups of tea.
The training starts at the time S (counted in seconds, from some predefined
moment of time) and Andrew comes at the time P (also in seconds, counted from
the same moment of time).
Your task is to find how many cups of tea Andrew owes.
Input
The input file contains single line with integer numbers S and P (0 <= S,P <= 10^4).
Output
Write to the output file the number of cups Andrew owes.
Sample test(s)
Input
Test #1
10 10
Test #2
10 11
Test #3
0 300
Output
Test #1
0
Test #2
1
Test #3
2
*
*/
import java.util.Scanner;
public class P276 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int s = in.nextInt();
int p = in.nextInt();
if(p <= s)
System.out.println(0);
else if(p - s > 0 && p - s < 300)
System.out.println(1);
else if(p - s >= 300 && p - s < 900)
System.out.println(2);
else if(p - s >= 900 && p - s < 1800)
System.out.println(3);
else
System.out.println(4);
}
}