結果

問題 No.486 3 Straight Win(3連勝)
ユーザー bellbell
提出日時 2021-02-20 17:33:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 5,805 ms
コンパイル使用メモリ 74,612 KB
実行使用メモリ 57,584 KB
最終ジャッジ日時 2023-10-18 22:08:09
合計ジャッジ時間 6,946 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
57,304 KB
testcase_01 AC 126 ms
57,448 KB
testcase_02 AC 126 ms
57,348 KB
testcase_03 AC 126 ms
57,548 KB
testcase_04 AC 126 ms
57,356 KB
testcase_05 AC 128 ms
57,356 KB
testcase_06 AC 126 ms
57,416 KB
testcase_07 AC 127 ms
57,444 KB
testcase_08 AC 129 ms
57,452 KB
testcase_09 AC 128 ms
57,448 KB
testcase_10 AC 127 ms
57,176 KB
testcase_11 AC 128 ms
57,468 KB
testcase_12 AC 126 ms
57,324 KB
testcase_13 AC 126 ms
57,584 KB
testcase_14 AC 126 ms
57,484 KB
testcase_15 AC 127 ms
57,444 KB
testcase_16 AC 127 ms
57,400 KB
testcase_17 AC 126 ms
57,320 KB
testcase_18 AC 128 ms
57,436 KB
testcase_19 AC 127 ms
57,484 KB
testcase_20 AC 128 ms
57,444 KB
testcase_21 AC 126 ms
57,352 KB
testcase_22 AC 127 ms
57,288 KB
testcase_23 AC 130 ms
57,436 KB
testcase_24 AC 130 ms
57,484 KB
testcase_25 AC 128 ms
57,436 KB
testcase_26 AC 129 ms
57,520 KB
testcase_27 AC 129 ms
57,440 KB
権限があれば一括ダウンロードができます

ソースコード

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