結果

問題 No.486 3 Straight Win(3連勝)
ユーザー GoryudyumaGoryudyuma
提出日時 2017-03-13 08:55:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 983 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 71,148 KB
実行使用メモリ 56,224 KB
最終ジャッジ日時 2023-09-08 11:00:13
合計ジャッジ時間 6,422 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,164 KB
testcase_01 AC 116 ms
55,672 KB
testcase_02 AC 117 ms
55,772 KB
testcase_03 AC 118 ms
55,900 KB
testcase_04 AC 116 ms
55,588 KB
testcase_05 AC 117 ms
55,836 KB
testcase_06 AC 116 ms
55,912 KB
testcase_07 AC 114 ms
55,796 KB
testcase_08 AC 115 ms
55,648 KB
testcase_09 AC 115 ms
55,872 KB
testcase_10 AC 117 ms
55,772 KB
testcase_11 AC 118 ms
55,736 KB
testcase_12 AC 116 ms
55,944 KB
testcase_13 AC 116 ms
55,736 KB
testcase_14 AC 115 ms
54,248 KB
testcase_15 AC 117 ms
55,956 KB
testcase_16 AC 117 ms
56,224 KB
testcase_17 AC 117 ms
55,860 KB
testcase_18 AC 115 ms
55,832 KB
testcase_19 AC 112 ms
55,808 KB
testcase_20 AC 116 ms
55,964 KB
testcase_21 AC 114 ms
55,964 KB
testcase_22 AC 120 ms
56,024 KB
testcase_23 AC 115 ms
55,736 KB
testcase_24 AC 119 ms
55,536 KB
testcase_25 AC 117 ms
55,720 KB
testcase_26 AC 115 ms
55,992 KB
testcase_27 AC 115 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                String S = sc.next();
                int E = 0, W = 0;
                for (int i = 0; i < S.length(); i++) {
                        if (S.charAt(i) == 'O') {
                                E++;
                                W=0;
                                if (E >= 3) {
                                        System.out.println("East");
                                        return;
                                }
                        } else {
                                W++;
                                E=0;
                                if (W >= 3) {
                                        System.out.println("West");
                                        return;
                                }
                        }
                }
                System.out.println("NA");
        }
}
0