Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // game loop
- while (true) {
- int count = in.nextInt(); //
- String closestEnemy = "";
- int minDist = 1000;
- for (int i = 0; i < count; i++) {
- String enemy = in.next(); // The name of this enemy
- int dist = in.nextInt(); // The distance to your canon of this enemy
- if(dist <= minDist) {
- minDist = dist;
- closest Enemy = enemy;
- }
- } <- this one
- System.out.println(closestEnemy); //
- } <- this one too
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement