結果

問題 No.486 3 Straight Win(3連勝)
ユーザー yun_app
提出日時 2017-03-08 14:44:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,044 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 74,656 KB
実行使用メモリ 51,852 KB
最終ジャッジ日時 2024-06-26 04:17:03
合計ジャッジ時間 4,547 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

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