結果

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

ソースコード

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