結果

問題 No.486 3 Straight Win(3連勝)
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-10 14:40:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 71,416 KB
実行使用メモリ 57,716 KB
最終ジャッジ日時 2023-09-08 11:20:13
合計ジャッジ時間 6,862 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,352 KB
testcase_01 AC 117 ms
55,692 KB
testcase_02 AC 117 ms
55,980 KB
testcase_03 AC 117 ms
56,052 KB
testcase_04 AC 117 ms
56,076 KB
testcase_05 AC 118 ms
56,248 KB
testcase_06 AC 118 ms
55,888 KB
testcase_07 AC 117 ms
55,848 KB
testcase_08 AC 116 ms
56,420 KB
testcase_09 AC 117 ms
56,036 KB
testcase_10 AC 119 ms
56,092 KB
testcase_11 AC 118 ms
55,928 KB
testcase_12 AC 117 ms
55,800 KB
testcase_13 AC 116 ms
56,132 KB
testcase_14 AC 117 ms
56,024 KB
testcase_15 AC 117 ms
56,016 KB
testcase_16 AC 116 ms
55,608 KB
testcase_17 AC 116 ms
57,716 KB
testcase_18 AC 116 ms
56,324 KB
testcase_19 AC 116 ms
55,692 KB
testcase_20 AC 116 ms
56,216 KB
testcase_21 AC 116 ms
55,664 KB
testcase_22 AC 117 ms
55,964 KB
testcase_23 AC 118 ms
56,064 KB
testcase_24 AC 117 ms
55,924 KB
testcase_25 AC 115 ms
56,208 KB
testcase_26 AC 115 ms
55,860 KB
testcase_27 AC 117 ms
55,592 KB
権限があれば一括ダウンロードができます

ソースコード

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') {east++; west = 0;}
			else {west++; east = 0;}
			if (west==3 || 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