結果

問題 No.486 3 Straight Win(3連勝)
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-21 23:27:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 3,183 ms
コンパイル使用メモリ 71,528 KB
実行使用メモリ 51,376 KB
最終ジャッジ日時 2023-09-08 11:16:00
合計ジャッジ時間 5,384 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,268 KB
testcase_01 AC 43 ms
49,412 KB
testcase_02 AC 43 ms
49,324 KB
testcase_03 AC 43 ms
49,268 KB
testcase_04 AC 43 ms
49,212 KB
testcase_05 AC 43 ms
49,192 KB
testcase_06 AC 43 ms
49,448 KB
testcase_07 AC 42 ms
49,128 KB
testcase_08 AC 44 ms
51,376 KB
testcase_09 AC 43 ms
49,188 KB
testcase_10 AC 42 ms
49,676 KB
testcase_11 AC 43 ms
49,132 KB
testcase_12 AC 42 ms
49,088 KB
testcase_13 AC 42 ms
49,296 KB
testcase_14 AC 42 ms
49,244 KB
testcase_15 AC 43 ms
49,320 KB
testcase_16 AC 43 ms
49,320 KB
testcase_17 AC 42 ms
49,500 KB
testcase_18 AC 42 ms
49,284 KB
testcase_19 AC 42 ms
49,308 KB
testcase_20 AC 42 ms
49,272 KB
testcase_21 AC 43 ms
49,416 KB
testcase_22 AC 43 ms
49,200 KB
testcase_23 AC 43 ms
49,344 KB
testcase_24 AC 43 ms
49,464 KB
testcase_25 AC 43 ms
49,240 KB
testcase_26 AC 42 ms
49,624 KB
testcase_27 AC 43 ms
47,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No486 {
	public static void main(String[] args) throws IOException{
		String str = new BufferedReader(new InputStreamReader(System.in)).readLine();
		char[] syohai = str.toCharArray();
		judge(syohai);
	}
	
	public static void judge(char[] chr){
		int eastV = 0;
		int westV = 0;
		for(int i=0; i<chr.length; i++){
			if(chr[i] == 'O'){
				eastV++;
				westV = 0;
			} else if(chr[i] == 'X'){
				westV++;
				eastV = 0;
			}
			if(eastV == 3) {
				System.out.println("East");
				break;
			} else if(westV == 3) {
				System.out.println("West");
				break;
			}
		}
		if(eastV != 3 && westV != 3) System.out.println("NA");
	}
}
0