結果

問題 No.486 3 Straight Win(3連勝)
ユーザー yamax3232yamax3232
提出日時 2018-03-16 13:47:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 641 bytes
コンパイル時間 3,242 ms
コンパイル使用メモリ 71,308 KB
実行使用メモリ 56,268 KB
最終ジャッジ日時 2023-09-08 11:22:17
合計ジャッジ時間 8,247 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,616 KB
testcase_01 AC 128 ms
56,004 KB
testcase_02 AC 129 ms
55,912 KB
testcase_03 AC 132 ms
56,008 KB
testcase_04 AC 127 ms
55,904 KB
testcase_05 AC 125 ms
55,972 KB
testcase_06 AC 129 ms
55,608 KB
testcase_07 AC 126 ms
55,956 KB
testcase_08 AC 125 ms
55,772 KB
testcase_09 AC 128 ms
53,688 KB
testcase_10 AC 131 ms
55,800 KB
testcase_11 AC 125 ms
55,560 KB
testcase_12 AC 126 ms
56,008 KB
testcase_13 AC 124 ms
55,696 KB
testcase_14 AC 127 ms
55,452 KB
testcase_15 AC 124 ms
55,772 KB
testcase_16 AC 127 ms
55,344 KB
testcase_17 AC 126 ms
55,692 KB
testcase_18 AC 127 ms
55,900 KB
testcase_19 AC 126 ms
53,996 KB
testcase_20 AC 129 ms
55,784 KB
testcase_21 AC 125 ms
55,864 KB
testcase_22 AC 127 ms
56,268 KB
testcase_23 AC 125 ms
55,736 KB
testcase_24 AC 128 ms
55,768 KB
testcase_25 AC 125 ms
55,612 KB
testcase_26 AC 124 ms
55,896 KB
testcase_27 AC 126 ms
56,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner kb=new Scanner(System.in);
		String s=kb.nextLine();
		int w=0,e=0;
		for(int i=0;i<s.length();i++){
			if(i+2<s.length()){
				if(s.charAt(i)=='O'&&
						s.charAt(i+1)=='O'&&
						s.charAt(i+2)=='O'){
					e++;
					break;
				}if(s.charAt(i)=='X'&&
						s.charAt(i+1)=='X'&&
						s.charAt(i+2)=='X'){
					w++;
					break;
				}
			}
		}
		if(e==1){
			System.out.println("East");
		}else if(w==1){
			System.out.println("West");
		}else{
			System.out.println("NA");
		}
	}

}
0