結果

問題 No.486 3 Straight Win(3連勝)
ユーザー AoiroFukurouAoiroFukurou
提出日時 2017-02-26 13:42:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 540 bytes
コンパイル時間 3,592 ms
コンパイル使用メモリ 72,060 KB
実行使用メモリ 58,336 KB
最終ジャッジ日時 2023-09-02 09:52:00
合計ジャッジ時間 7,839 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 114 ms
56,284 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 117 ms
56,212 KB
testcase_13 WA -
testcase_14 AC 115 ms
56,380 KB
testcase_15 AC 116 ms
54,320 KB
testcase_16 WA -
testcase_17 AC 117 ms
55,820 KB
testcase_18 AC 118 ms
56,088 KB
testcase_19 AC 119 ms
56,160 KB
testcase_20 AC 117 ms
55,820 KB
testcase_21 AC 115 ms
56,244 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 115 ms
55,968 KB
testcase_25 AC 118 ms
55,696 KB
testcase_26 AC 117 ms
55,828 KB
testcase_27 AC 116 ms
56,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package sg20170226;

import java.util.Scanner;

public class No_486 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int W = 0;
		int L = 0;
		for (int i = 1; i <= s.length(); i++) {
			String s2 = s.substring(i - 1, i);
			if (s2.equals("O")) {
				W++;
				L = 0;
			} else if (s2.equals("X")) {
				L++;
				W = 0;
			}
		}
		if (W >= 3) {
			System.out.println("East");
		} else if (L >= 3) {
			System.out.println("West");
		} else {
			System.out.println("NA");
		}
	}
}
0