結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー |
![]() |
提出日時 | 2017-12-09 23:19:30 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 1,033 bytes |
コンパイル時間 | 3,314 ms |
コンパイル使用メモリ | 77,036 KB |
実行使用メモリ | 37,084 KB |
最終ジャッジ日時 | 2024-06-26 04:36:20 |
合計ジャッジ時間 | 5,811 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
/*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");}}}}