-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVolim.java
More file actions
39 lines (29 loc) · 826 Bytes
/
Copy pathVolim.java
File metadata and controls
39 lines (29 loc) · 826 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
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int k = scanner.nextInt();
int n = scanner.nextInt();
boolean hasExploded = false;
int totalTime = 210;
for (int i = 0; i< n; i++) {
int time = scanner.nextInt();
String z = scanner.next();
totalTime -= time;
if (totalTime < 0) {
hasExploded = true;
break;
}
if (z.equals("T")) {
k += 1;
}
}
while (k > 8) {
k -= 8;
}
if ( k == 0) {
k = 1;
}
System.out.println(k);
}
}