-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathJava.java
42 lines (36 loc) · 1.1 KB
/
Java.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
/****************************************/
/* */
/* CodinGame.com Solutions by pathosDev */
/* */
/* Puzzle: The Descent */
/* Difficulty: Easy */
/* Date solved: 08.11.2018 */
/* */
/****************************************/
import java.util.Scanner;
class Player
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
//Game loop.
while (true)
{
int max = 0;
int maxIndex = -1;
for (int i = 0; i < 8; i++)
{
//Read inputs.
int mountainH = Integer.parseInt(scanner.nextLine());
//Set highest mountain.
if (mountainH > max)
{
max = mountainH;
maxIndex = i;
}
}
//Output highest mountain.
System.out.println(maxIndex);
}
}
}