結果

問題 No.486 3 Straight Win(3連勝)
ユーザー yun_appyun_app
提出日時 2017-03-08 14:44:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 1,044 bytes
コンパイル時間 2,068 ms
コンパイル使用メモリ 70,828 KB
実行使用メモリ 49,492 KB
最終ジャッジ日時 2023-09-08 10:58:16
合計ジャッジ時間 4,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,284 KB
testcase_01 AC 45 ms
49,236 KB
testcase_02 AC 41 ms
48,916 KB
testcase_03 AC 42 ms
48,924 KB
testcase_04 AC 42 ms
49,056 KB
testcase_05 AC 42 ms
49,276 KB
testcase_06 AC 41 ms
49,180 KB
testcase_07 AC 42 ms
49,120 KB
testcase_08 AC 42 ms
48,916 KB
testcase_09 AC 43 ms
49,180 KB
testcase_10 AC 42 ms
48,924 KB
testcase_11 AC 43 ms
49,128 KB
testcase_12 AC 42 ms
49,016 KB
testcase_13 AC 42 ms
47,660 KB
testcase_14 AC 42 ms
49,156 KB
testcase_15 AC 42 ms
48,984 KB
testcase_16 AC 42 ms
49,300 KB
testcase_17 AC 42 ms
49,132 KB
testcase_18 AC 42 ms
49,364 KB
testcase_19 AC 43 ms
49,364 KB
testcase_20 AC 43 ms
49,156 KB
testcase_21 AC 42 ms
49,276 KB
testcase_22 AC 41 ms
49,492 KB
testcase_23 AC 42 ms
49,116 KB
testcase_24 AC 42 ms
49,280 KB
testcase_25 AC 42 ms
49,492 KB
testcase_26 AC 42 ms
49,064 KB
testcase_27 AC 43 ms
49,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    
    
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int east = 0;
        int west = 0;
        for(int i=0;i<line.length();i++){
            char c = line.charAt(i);
            switch(c){
            case 'O':
                west=0;
                ++east;
                break;
            case 'X':
                east=0;
                ++west;
                break;
            }
            if(east>=3){
                System.out.println("East");
                return;
            }
            if(west>=3){
                System.out.println("West");
                return;
            }
        }
        System.out.println("NA");
    }
}
0