結果

問題 No.486 3 Straight Win(3連勝)
ユーザー KibidanKibidan
提出日時 2017-02-24 22:51:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 771 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 71,488 KB
実行使用メモリ 56,180 KB
最終ジャッジ日時 2023-09-08 10:43:57
合計ジャッジ時間 6,777 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,512 KB
testcase_01 AC 122 ms
53,916 KB
testcase_02 AC 121 ms
55,384 KB
testcase_03 AC 121 ms
55,776 KB
testcase_04 AC 121 ms
55,628 KB
testcase_05 AC 120 ms
55,720 KB
testcase_06 AC 121 ms
55,852 KB
testcase_07 AC 121 ms
55,500 KB
testcase_08 AC 121 ms
55,620 KB
testcase_09 AC 120 ms
55,144 KB
testcase_10 AC 122 ms
55,776 KB
testcase_11 AC 123 ms
55,776 KB
testcase_12 AC 121 ms
55,852 KB
testcase_13 AC 121 ms
55,524 KB
testcase_14 AC 120 ms
55,360 KB
testcase_15 AC 121 ms
55,804 KB
testcase_16 AC 122 ms
55,456 KB
testcase_17 AC 123 ms
55,804 KB
testcase_18 AC 122 ms
55,752 KB
testcase_19 AC 123 ms
55,932 KB
testcase_20 AC 122 ms
55,376 KB
testcase_21 AC 122 ms
55,548 KB
testcase_22 AC 123 ms
55,480 KB
testcase_23 AC 121 ms
55,816 KB
testcase_24 AC 121 ms
55,920 KB
testcase_25 AC 122 ms
55,692 KB
testcase_26 AC 120 ms
55,448 KB
testcase_27 AC 120 ms
56,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

        String reg="OOO";
        Pattern p=Pattern.compile(reg);
        Matcher m=p.matcher(s);
        if (m.find()){
            east=m.start();
        }

        reg="XXX";
        p=Pattern.compile(reg);
        m=p.matcher(s);
        if (m.find()){
            west=m.start();
        }

        if(east==west){
            System.out.println("NA");
        }else if(east<west){
            System.out.println("East");
        }else{
            System.out.println("West");
        }
    }
}

0