結果

問題 No.486 3 Straight Win(3連勝)
ユーザー losiz17losiz17
提出日時 2017-04-21 17:11:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 3,425 ms
コンパイル使用メモリ 72,588 KB
実行使用メモリ 57,992 KB
最終ジャッジ日時 2023-09-08 11:07:35
合計ジャッジ時間 8,012 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,852 KB
testcase_01 AC 118 ms
55,840 KB
testcase_02 AC 118 ms
55,680 KB
testcase_03 AC 118 ms
55,900 KB
testcase_04 AC 117 ms
55,468 KB
testcase_05 AC 116 ms
55,428 KB
testcase_06 AC 115 ms
55,844 KB
testcase_07 AC 117 ms
55,688 KB
testcase_08 AC 117 ms
55,828 KB
testcase_09 AC 117 ms
56,076 KB
testcase_10 AC 117 ms
55,756 KB
testcase_11 AC 119 ms
53,908 KB
testcase_12 AC 116 ms
55,524 KB
testcase_13 AC 117 ms
56,032 KB
testcase_14 AC 118 ms
55,720 KB
testcase_15 AC 120 ms
55,748 KB
testcase_16 AC 118 ms
56,088 KB
testcase_17 AC 118 ms
55,676 KB
testcase_18 AC 118 ms
55,828 KB
testcase_19 AC 116 ms
56,024 KB
testcase_20 AC 116 ms
57,992 KB
testcase_21 AC 117 ms
55,888 KB
testcase_22 AC 119 ms
56,128 KB
testcase_23 AC 119 ms
55,820 KB
testcase_24 AC 119 ms
55,896 KB
testcase_25 AC 117 ms
54,036 KB
testcase_26 AC 115 ms
55,924 KB
testcase_27 AC 116 ms
56,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Tatakai {
	
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		
		int west = 0;
		int east = 0;
		
		String str = sc.next();
		
		for(int i=0; i<str.length(); i++){
			if(str.charAt(i) == 'X'){
				east = 0;
				west++;
				if(west>=3){
					System.out.println("West");
					return;
				}
			}
			if(str.charAt(i) == 'O'){
				east++;
				west = 0;
				if(east>=3){
					System.out.println("East");
					return;
				}
			}
			
		}
		System.out.println("NA");
	}
}
0