結果

問題 No.486 3 Straight Win(3連勝)
ユーザー GrenacheGrenache
提出日時 2017-02-24 22:25:37
言語 Java19
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 808 bytes
コンパイル時間 5,269 ms
コンパイル使用メモリ 72,008 KB
実行使用メモリ 56,268 KB
最終ジャッジ日時 2023-09-08 10:34:51
合計ジャッジ時間 8,180 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,540 KB
testcase_01 AC 120 ms
55,400 KB
testcase_02 AC 120 ms
55,728 KB
testcase_03 AC 120 ms
56,268 KB
testcase_04 AC 122 ms
53,472 KB
testcase_05 AC 119 ms
55,860 KB
testcase_06 AC 122 ms
55,588 KB
testcase_07 AC 121 ms
55,596 KB
testcase_08 AC 118 ms
55,468 KB
testcase_09 AC 119 ms
55,740 KB
testcase_10 AC 119 ms
55,456 KB
testcase_11 AC 120 ms
55,972 KB
testcase_12 AC 121 ms
55,568 KB
testcase_13 AC 120 ms
53,600 KB
testcase_14 AC 120 ms
55,568 KB
testcase_15 AC 119 ms
55,536 KB
testcase_16 AC 121 ms
55,864 KB
testcase_17 AC 119 ms
55,384 KB
testcase_18 AC 122 ms
55,496 KB
testcase_19 AC 122 ms
55,580 KB
testcase_20 AC 120 ms
55,752 KB
testcase_21 AC 121 ms
55,664 KB
testcase_22 AC 119 ms
55,452 KB
testcase_23 AC 120 ms
55,496 KB
testcase_24 AC 121 ms
55,436 KB
testcase_25 AC 123 ms
55,460 KB
testcase_26 AC 122 ms
55,532 KB
testcase_27 AC 123 ms
55,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder486 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();

		int east = 0;
		int west = 0;

		for (char c : s) {
			if (c == 'O') {
				east++;
				west = 0;
			} else {
				west++;
				east = 0;
			}

			if (west >= 3) {
				pr.println("West");
				return;
			} else if (east >= 3) {
				pr.println("East");
				return;
			}
		}

		pr.println("NA");
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0