結果

問題 No.486 3 Straight Win(3連勝)
ユーザー kazapyon27kazapyon27
提出日時 2017-12-09 23:19:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 1,033 bytes
コンパイル時間 3,196 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 51,404 KB
最終ジャッジ日時 2023-09-08 11:17:39
合計ジャッジ時間 5,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,316 KB
testcase_01 AC 44 ms
49,448 KB
testcase_02 AC 42 ms
49,440 KB
testcase_03 AC 43 ms
49,440 KB
testcase_04 AC 43 ms
47,380 KB
testcase_05 AC 42 ms
49,444 KB
testcase_06 AC 42 ms
49,796 KB
testcase_07 AC 42 ms
49,644 KB
testcase_08 AC 42 ms
49,252 KB
testcase_09 AC 42 ms
49,320 KB
testcase_10 AC 42 ms
49,376 KB
testcase_11 AC 42 ms
49,256 KB
testcase_12 AC 42 ms
49,324 KB
testcase_13 AC 43 ms
49,368 KB
testcase_14 AC 42 ms
49,748 KB
testcase_15 AC 43 ms
49,452 KB
testcase_16 AC 43 ms
49,536 KB
testcase_17 AC 43 ms
49,436 KB
testcase_18 AC 43 ms
49,484 KB
testcase_19 AC 42 ms
49,608 KB
testcase_20 AC 42 ms
49,436 KB
testcase_21 AC 42 ms
47,324 KB
testcase_22 AC 43 ms
49,452 KB
testcase_23 AC 44 ms
51,404 KB
testcase_24 AC 42 ms
49,408 KB
testcase_25 AC 42 ms
49,576 KB
testcase_26 AC 43 ms
49,324 KB
testcase_27 AC 42 ms
49,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*No.486 3 Straight Win(3連勝)*/
import java.io.*;
public class No486 {
	public static void main(String[] args) {
		try(BufferedReader input =new BufferedReader(new InputStreamReader(System.in))){
			String result=input.readLine();
			int eastPoint=Search(result,"East"),westPoint=Search(result,"West");			
			if(eastPoint==-1||westPoint==-1){
				Judge(eastPoint,westPoint,true);
			}else{
				Judge(eastPoint,westPoint,false);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	static int Search (String result,String team){
		int score=0;
		if(team.equals("East")){
			score=result.indexOf("OOO");
		}else if(team.equals("West")){
			score=result.indexOf("XXX");
		}
		return score;
	}
	static void Judge(int East,int West,boolean flg){
		if(flg==true){
			if(East>West){
				System.out.println("East");
			}else if(East<West){
				System.out.println("West");
			}else{
				System.out.println("NA");
			}
		}else{
			if(East<West){
				System.out.println("East");
			}else{
				System.out.println("West");
			}
		}
	}
}
0