結果

問題 No.1506 Unbalanced Pocky Game
ユーザー ks2m
提出日時 2021-05-14 22:18:11
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 3,201 ms
コンパイル使用メモリ 75,220 KB
実行使用メモリ 63,936 KB
最終ジャッジ日時 2024-10-02 01:46:15
合計ジャッジ時間 31,897 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		boolean[] b = new boolean[n + 1];
		for (int i = 0; i < n; i++) {
			b[i + 1] = !b[i];
			if (i % 2 == 1) {
				if (a[i] > 1) {
					b[i + 1] = !b[i + 1];
				}
			}
		}
		if (b[n]) {
			System.out.println("Alice");
		} else {
			System.out.println("Bob");
		}
	}
}
0