結果

問題 No.1506 Unbalanced Pocky Game
ユーザー ks2m
提出日時 2021-05-14 22:23:04
言語 Java
(openjdk 23)
結果
AC  
実行時間 807 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 2,191 ms
コンパイル使用メモリ 74,740 KB
実行使用メモリ 53,392 KB
最終ジャッジ日時 2024-10-02 01:58:06
合計ジャッジ時間 34,940 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 63
権限があれば一括ダウンロードができます

ソースコード

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 (!b[i + 1] && a[i] > 1) {
				b[i + 1] = !b[i + 1];
			}
		}
		if (b[n]) {
			System.out.println("Alice");
		} else {
			System.out.println("Bob");
		}
	}
}
0