본문 바로가기
GAME/www.codingame.com

The Descent

by 므시칸곰틔군 2015. 2. 9.

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);



        


        // game loop

        while (true) {

            

            String str = "HOLD";

            int check = 0;

            int check_i = -1;

            

            

            int SX = in.nextInt();

            int SY = in.nextInt();

            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.

                

                if(MH> check && MH !=0){

                    check = MH;

                    check_i=i;

                    System.err.println("if check :"+check);

                    System.err.println("if check_i :"+check_i);

                }

            }

            if(SX == check_i){

                str="FIRE";

            }

                

            // Write an action using System.out.println()

            // To debug: System.err.println("Debug messages...");


            System.out.println(str); // either:  FIRE (ship is firing its phase cannons) or HOLD (ship is not firing).

        }

    }

}

'GAME > www.codingame.com' 카테고리의 다른 글

Temperatures  (0) 2015.02.11
Skynet: the Chasm  (0) 2015.02.10
Power of Thor  (0) 2015.02.10
OnBoarding  (0) 2015.02.09