結果

問題 No.486 3 Straight Win(3連勝)
ユーザー Tsukasa_Type
提出日時 2018-02-10 14:38:14
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 2,439 ms
コンパイル使用メモリ 73,876 KB
実行使用メモリ 54,420 KB
最終ジャッジ日時 2024-10-13 11:00:30
合計ジャッジ時間 6,651 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		int west = 0;
		int east = 0;
		boolean win = false;
		for (int i=0; i<s.length(); i++) {
			if (s.charAt(i)=='O') {west++; east = 0;}
			else {east++; west = 0;}
			if (west==3) {win = true; break;}
			else if (east==3) {win = true; break;}
		}
		
		if (win==true) {
			if (west==3) {System.out.println("West");}
			else if (east==3) {System.out.println("East");}
		}
		else {
			System.out.println("NA");
		}
	}
}
0