結果

問題 No.486 3 Straight Win(3連勝)
ユーザー bell
提出日時 2021-02-20 17:33:25
言語 Java
(openjdk 23)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 79,016 KB
実行使用メモリ 54,196 KB
最終ジャッジ日時 2024-09-18 18:09:20
合計ジャッジ時間 5,747 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

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 {
				result = "NA";}

		}
		System.out.println(result);
    }
}
0