結果

問題 No.486 3 Straight Win(3連勝)
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-12 21:34:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 2,683 ms
コンパイル使用メモリ 71,536 KB
実行使用メモリ 56,064 KB
最終ジャッジ日時 2023-09-08 11:15:43
合計ジャッジ時間 7,233 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,592 KB
testcase_01 AC 120 ms
55,840 KB
testcase_02 AC 117 ms
55,728 KB
testcase_03 AC 117 ms
56,064 KB
testcase_04 AC 116 ms
55,804 KB
testcase_05 AC 120 ms
53,692 KB
testcase_06 AC 118 ms
55,728 KB
testcase_07 AC 117 ms
55,704 KB
testcase_08 AC 117 ms
55,836 KB
testcase_09 AC 116 ms
55,684 KB
testcase_10 AC 122 ms
55,660 KB
testcase_11 AC 119 ms
55,796 KB
testcase_12 AC 119 ms
55,600 KB
testcase_13 AC 120 ms
55,668 KB
testcase_14 AC 116 ms
55,668 KB
testcase_15 AC 116 ms
55,672 KB
testcase_16 AC 120 ms
55,668 KB
testcase_17 AC 118 ms
55,392 KB
testcase_18 AC 121 ms
55,708 KB
testcase_19 AC 119 ms
55,696 KB
testcase_20 AC 118 ms
55,412 KB
testcase_21 AC 122 ms
55,996 KB
testcase_22 AC 122 ms
56,028 KB
testcase_23 AC 121 ms
55,952 KB
testcase_24 AC 118 ms
55,876 KB
testcase_25 AC 119 ms
55,796 KB
testcase_26 AC 118 ms
53,644 KB
testcase_27 AC 118 ms
56,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

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