結果

問題 No.486 3 Straight Win(3連勝)
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-05-04 10:54:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 71,484 KB
実行使用メモリ 49,756 KB
最終ジャッジ日時 2023-09-08 11:07:52
合計ジャッジ時間 4,281 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,388 KB
testcase_01 AC 43 ms
49,404 KB
testcase_02 AC 42 ms
49,368 KB
testcase_03 AC 43 ms
49,008 KB
testcase_04 AC 43 ms
49,112 KB
testcase_05 AC 44 ms
49,496 KB
testcase_06 AC 42 ms
49,292 KB
testcase_07 AC 43 ms
49,368 KB
testcase_08 AC 43 ms
48,996 KB
testcase_09 AC 42 ms
47,700 KB
testcase_10 AC 43 ms
49,136 KB
testcase_11 AC 43 ms
48,996 KB
testcase_12 AC 44 ms
49,628 KB
testcase_13 AC 43 ms
49,260 KB
testcase_14 AC 43 ms
49,100 KB
testcase_15 AC 43 ms
49,412 KB
testcase_16 AC 43 ms
49,664 KB
testcase_17 AC 43 ms
49,068 KB
testcase_18 AC 42 ms
49,272 KB
testcase_19 AC 43 ms
49,124 KB
testcase_20 AC 43 ms
49,340 KB
testcase_21 AC 42 ms
49,564 KB
testcase_22 AC 43 ms
49,488 KB
testcase_23 AC 44 ms
49,212 KB
testcase_24 AC 44 ms
49,756 KB
testcase_25 AC 43 ms
49,276 KB
testcase_26 AC 42 ms
49,192 KB
testcase_27 AC 43 ms
49,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String S = reader.readLine();
        int west  = 0;
        int east = 0;
        String result = "NA";
        for (int i = 0; i < S.length(); i++) {
            if(S.charAt(i)=='O') {
                east+=1;
                west=0;
            } else {
                west+=1;
                east=0;
            }

            if(west==3) {
                result="West";
                break;
            } else if ( east == 3) {
                result="East";
                break;
            }
        }
        System.out.println(result);
    }
}
0