Skip to content

Commit 1e35425

Browse files
authored
Kattis solutions
1 parent 58af1f5 commit 1e35425

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Kattis/TouchDown/Main22.java

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import java.util.Scanner;
2+
3+
/**
4+
* Created by AMK on 7/25/2019.
5+
* Life is nice :)
6+
* Enjoy coding :D
7+
*/
8+
public class Main22 {
9+
public static void main(String[] args) {
10+
Scanner scanner = new Scanner(System.in);
11+
int n = scanner.nextInt();
12+
int pos = 20;
13+
int sum = 0;
14+
int rem = 4;
15+
for (int i = 0; i < n; i++) {
16+
int x = scanner.nextInt();
17+
sum += x;
18+
pos += x;
19+
if (sum < 10){
20+
rem--;
21+
}else{
22+
rem = 4;
23+
sum = 0;
24+
}
25+
if (rem == 0) {
26+
System.out.println("Nothing");
27+
return;
28+
}
29+
if (pos >= 100){
30+
System.out.println("Touchdown");
31+
return;
32+
}else if (pos <= 0){
33+
System.out.println("Safety");
34+
return;
35+
}
36+
}
37+
System.out.println("Nothing");
38+
}
39+
}

0 commit comments

Comments
 (0)