結果

問題 No.486 3 Straight Win(3連勝)
ユーザー YamaKasaYamaKasa
提出日時 2018-05-06 17:23:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 71,616 KB
実行使用メモリ 57,904 KB
最終ジャッジ日時 2023-09-10 10:47:09
合計ジャッジ時間 7,066 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,576 KB
testcase_01 AC 120 ms
55,584 KB
testcase_02 AC 120 ms
55,684 KB
testcase_03 AC 121 ms
55,984 KB
testcase_04 AC 119 ms
55,700 KB
testcase_05 AC 119 ms
55,940 KB
testcase_06 AC 121 ms
55,740 KB
testcase_07 AC 119 ms
55,568 KB
testcase_08 AC 119 ms
56,264 KB
testcase_09 AC 121 ms
57,904 KB
testcase_10 AC 120 ms
55,104 KB
testcase_11 AC 120 ms
55,788 KB
testcase_12 AC 120 ms
55,316 KB
testcase_13 AC 119 ms
55,540 KB
testcase_14 AC 121 ms
56,004 KB
testcase_15 AC 120 ms
55,596 KB
testcase_16 AC 119 ms
55,356 KB
testcase_17 AC 120 ms
55,812 KB
testcase_18 AC 120 ms
55,264 KB
testcase_19 AC 118 ms
55,780 KB
testcase_20 AC 121 ms
55,356 KB
testcase_21 AC 119 ms
55,344 KB
testcase_22 AC 122 ms
55,576 KB
testcase_23 AC 121 ms
55,496 KB
testcase_24 AC 121 ms
55,332 KB
testcase_25 AC 121 ms
55,624 KB
testcase_26 AC 123 ms
55,844 KB
testcase_27 AC 121 ms
55,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		scan.close();
		int cnt1 = 0;
		int cnt2 = 0;
		for(int i = 0; i < S.length(); i++) {
			char c = S.charAt(i);
			if(c == 'O') {
				cnt1 ++;
				cnt2 = 0;
			}else {
				cnt1 = 0;
				cnt2 ++;
			}
			if(cnt1 == 3) {
				System.out.println("East");
				System.exit(0);
			}else if(cnt2 == 3) {
				System.out.println("West");
				System.exit(0);
			}
		}
		System.out.println("NA");
	}
}
0