結果

問題 No.486 3 Straight Win(3連勝)
ユーザー AoiroFukurouAoiroFukurou
提出日時 2017-02-26 14:12:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 3,555 ms
コンパイル使用メモリ 71,916 KB
実行使用メモリ 56,800 KB
最終ジャッジ日時 2023-09-08 10:51:38
合計ジャッジ時間 8,536 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,732 KB
testcase_01 AC 126 ms
55,684 KB
testcase_02 AC 122 ms
55,948 KB
testcase_03 AC 121 ms
56,040 KB
testcase_04 AC 121 ms
55,716 KB
testcase_05 AC 122 ms
56,260 KB
testcase_06 AC 123 ms
55,996 KB
testcase_07 AC 122 ms
55,928 KB
testcase_08 AC 123 ms
55,520 KB
testcase_09 AC 122 ms
56,140 KB
testcase_10 AC 124 ms
55,752 KB
testcase_11 AC 121 ms
55,816 KB
testcase_12 AC 123 ms
55,952 KB
testcase_13 AC 123 ms
55,688 KB
testcase_14 AC 123 ms
55,748 KB
testcase_15 AC 123 ms
56,104 KB
testcase_16 AC 122 ms
55,952 KB
testcase_17 AC 122 ms
56,064 KB
testcase_18 AC 123 ms
56,116 KB
testcase_19 AC 121 ms
55,628 KB
testcase_20 AC 124 ms
55,904 KB
testcase_21 AC 122 ms
55,968 KB
testcase_22 AC 123 ms
56,800 KB
testcase_23 AC 125 ms
55,692 KB
testcase_24 AC 120 ms
55,876 KB
testcase_25 AC 121 ms
55,788 KB
testcase_26 AC 122 ms
55,844 KB
testcase_27 AC 122 ms
55,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No_486 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int O = 0;
		int X = 0;
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c == 'O') {
				O++;
				X = 0;
			} else if (c == 'X') {
				X++;
				O = 0;
			}
			if(O >= 3 || X >= 3){
				break;
			}
		}
		if (O == 3) {
			System.out.println("East");
		} else if (X == 3) {
			System.out.println("West");
		} else {
			System.out.println("NA");
		}
	}
}
0