結果

問題 No.486 3 Straight Win(3連勝)
ユーザー samplelpmassamplelpmas
提出日時 2017-04-07 21:25:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 925 bytes
コンパイル時間 1,938 ms
コンパイル使用メモリ 71,936 KB
実行使用メモリ 58,200 KB
最終ジャッジ日時 2023-09-23 00:05:27
合計ジャッジ時間 6,704 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 115 ms
55,956 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 120 ms
55,816 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 118 ms
55,336 KB
testcase_09 WA -
testcase_10 AC 117 ms
55,640 KB
testcase_11 AC 118 ms
55,936 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 119 ms
55,672 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 118 ms
56,044 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 116 ms
55,724 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        char[] winLossRecord = sc.next().toCharArray();

        char previous = ' ';
        int winCount = 0;

        for (int i = 0; i < winLossRecord.length; i++) {

            char current = winLossRecord[i];

            if (previous == current) {

                winCount++;

                if (3 <= winCount) {

                    switch (current) {

                        case 'O' :
                            System.out.println("East");
                            return;
                        case 'X' :
                            System.out.println("Wast");
                            return;

                    }

                }

            } else {

                previous = current;
                winCount = 1;

            }

        }

    }

}
0