結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー |
|
提出日時 | 2021-02-20 17:31:54 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 601 bytes |
コンパイル時間 | 1,861 ms |
コンパイル使用メモリ | 74,468 KB |
実行使用メモリ | 54,660 KB |
最終ジャッジ日時 | 2024-09-18 18:08:29 |
合計ジャッジ時間 | 6,057 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 28 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String [] s = sc.next().split("");sc.close();int countE = 0;int countW = 0;String result = "";for ( int i = 0; i < s.length; i++ ){if ( s[i].equals("O")){countE++;countW = 0;} else if ( s[i].equals("X")){countW++;countE = 0;}if( countE == 3 ) {result = "East";break;} else if( countW == 3){result = "West";break;} else {System.out.println("NA");}}System.out.println(result);}}