結果

問題 No.2059 Odd Move Nim
ユーザー ks2m
提出日時 2022-08-26 21:50:33
言語 Java
(openjdk 23)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 72,804 KB
実行使用メモリ 57,640 KB
最終ジャッジ日時 2024-10-15 11:04:57
合計ジャッジ時間 6,804 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int x = 0;
		for (int i = 1; i < n; i += 2) {
			x ^= a[i];
		}
		if (x == 0) {
			System.out.println("Bob");
		} else {
			System.out.println("Alice");
		}
	}
}
0