結果

問題 No.486 3 Straight Win(3連勝)
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-05-16 23:47:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 721 bytes
コンパイル時間 1,879 ms
コンパイル使用メモリ 72,560 KB
実行使用メモリ 56,080 KB
最終ジャッジ日時 2023-09-10 22:25:41
合計ジャッジ時間 6,568 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,704 KB
testcase_01 AC 116 ms
55,724 KB
testcase_02 AC 117 ms
55,236 KB
testcase_03 AC 116 ms
55,664 KB
testcase_04 AC 117 ms
55,156 KB
testcase_05 AC 116 ms
55,692 KB
testcase_06 AC 117 ms
55,484 KB
testcase_07 AC 116 ms
56,080 KB
testcase_08 AC 116 ms
55,200 KB
testcase_09 AC 116 ms
55,612 KB
testcase_10 AC 119 ms
55,488 KB
testcase_11 AC 124 ms
55,692 KB
testcase_12 AC 124 ms
55,296 KB
testcase_13 AC 123 ms
55,296 KB
testcase_14 AC 121 ms
55,532 KB
testcase_15 AC 124 ms
55,548 KB
testcase_16 AC 116 ms
55,748 KB
testcase_17 AC 117 ms
55,436 KB
testcase_18 AC 117 ms
56,076 KB
testcase_19 AC 117 ms
55,624 KB
testcase_20 AC 117 ms
55,536 KB
testcase_21 AC 116 ms
55,160 KB
testcase_22 AC 117 ms
55,868 KB
testcase_23 AC 121 ms
53,756 KB
testcase_24 AC 116 ms
55,600 KB
testcase_25 AC 115 ms
55,824 KB
testcase_26 AC 115 ms
55,392 KB
testcase_27 AC 115 ms
55,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

        String ans = "NA";

        if(s.length() >= 3) {
            for(int i=1; i<s.length()-1; i++) {
                char c1 = s.charAt(i-1);
                char c2 = s.charAt(i);
                char c3 = s.charAt(i+1);
                if(c1 == 'O' && c2 == 'O' && c3 == 'O') {
                    ans = "East";
                    break;
                }
                if(c1 == 'X' && c2 == 'X' && c3 == 'X') {
                    ans = "West";
                    break;
                }
            }
        }

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