結果

問題 No.486 3 Straight Win(3連勝)
ユーザー yagi2yagi2
提出日時 2017-04-14 10:39:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 2,275 ms
コンパイル使用メモリ 74,064 KB
実行使用メモリ 56,284 KB
最終ジャッジ日時 2023-09-08 11:06:53
合計ジャッジ時間 6,858 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,640 KB
testcase_01 AC 122 ms
55,468 KB
testcase_02 AC 122 ms
56,228 KB
testcase_03 AC 119 ms
55,716 KB
testcase_04 AC 123 ms
55,888 KB
testcase_05 AC 121 ms
56,040 KB
testcase_06 AC 121 ms
56,284 KB
testcase_07 AC 121 ms
55,748 KB
testcase_08 AC 122 ms
56,260 KB
testcase_09 AC 123 ms
56,116 KB
testcase_10 AC 125 ms
55,520 KB
testcase_11 AC 122 ms
56,240 KB
testcase_12 AC 123 ms
56,260 KB
testcase_13 AC 122 ms
56,056 KB
testcase_14 AC 122 ms
55,892 KB
testcase_15 AC 122 ms
56,036 KB
testcase_16 AC 119 ms
55,708 KB
testcase_17 AC 124 ms
56,212 KB
testcase_18 AC 123 ms
56,192 KB
testcase_19 AC 123 ms
55,872 KB
testcase_20 AC 125 ms
56,068 KB
testcase_21 AC 128 ms
55,708 KB
testcase_22 AC 125 ms
55,564 KB
testcase_23 AC 124 ms
55,828 KB
testcase_24 AC 123 ms
56,192 KB
testcase_25 AC 123 ms
56,248 KB
testcase_26 AC 124 ms
55,756 KB
testcase_27 AC 121 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next() + "AA";

        if (S.length() < 5) {
            System.out.println("NA");
        } else {
            for (int i = 0; i < S.length() - 2; i++) {
                if (S.charAt(i) == 'O' && S.charAt(i + 1) == 'O' && S.charAt(i + 2) == 'O') {
                    System.out.println("East");
                    break;
                }
                if (S.charAt(i) == 'X' && S.charAt(i + 1) == 'X' && S.charAt(i + 2) == 'X') {
                    System.out.println("West");
                    break;
                }
                if (i == S.length() - 4) {
                    System.out.println("NA");
                    break;
                }
            }
        }
    }
}
0