Last active
May 22, 2016 13:10
-
-
Save bkopanja/987c5588f063c5004dcf to your computer and use it in GitHub Desktop.
Codingame - Kirk - The Descent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import java.math.*; | |
/** | |
* Auto-generated code below aims at helping you parse | |
* the standard input according to the problem statement. | |
**/ | |
class Player { | |
public static void main(String args[]) | |
{ | |
Scanner in = new Scanner(System.in); | |
int heightest; | |
int maxHeight; | |
// game loop | |
while (true) { | |
heightest = 0; | |
maxHeight = 0; | |
int SX = in.nextInt(); | |
int SY = in.nextInt(); | |
in.nextLine(); | |
for (int i = 0; i < 8; i++) { | |
int MH = in.nextInt(); // represents the height of one mountain, from 9 to 0. Mountain heights are provided from left to right. | |
in.nextLine(); | |
if(maxHeight < MH) { | |
maxHeight = MH; | |
heightest = i; | |
} | |
} | |
if(SX == heightest) | |
System.out.println("FIRE"); | |
else | |
System.out.println("HOLD"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
while True:
h = []
for i in range(8): h.append(int(input()))
print (h.index(max(h)))