結果

問題 No.2059 Odd Move Nim
ユーザー ks2mks2m
提出日時 2022-08-26 21:50:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 1,752 ms
コンパイル使用メモリ 74,604 KB
実行使用メモリ 68,528 KB
最終ジャッジ日時 2024-04-23 11:09:22
合計ジャッジ時間 6,037 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
50,000 KB
testcase_01 AC 46 ms
49,796 KB
testcase_02 AC 45 ms
50,188 KB
testcase_03 AC 47 ms
50,460 KB
testcase_04 AC 48 ms
50,360 KB
testcase_05 AC 46 ms
50,368 KB
testcase_06 AC 46 ms
50,412 KB
testcase_07 AC 45 ms
50,292 KB
testcase_08 AC 45 ms
50,116 KB
testcase_09 AC 46 ms
50,304 KB
testcase_10 AC 45 ms
50,292 KB
testcase_11 AC 47 ms
50,484 KB
testcase_12 AC 269 ms
68,528 KB
testcase_13 AC 262 ms
68,320 KB
testcase_14 AC 255 ms
68,128 KB
testcase_15 AC 262 ms
68,068 KB
testcase_16 AC 259 ms
68,196 KB
testcase_17 AC 262 ms
68,036 KB
testcase_18 AC 288 ms
68,060 KB
testcase_19 AC 257 ms
68,052 KB
testcase_20 AC 255 ms
67,884 KB
testcase_21 AC 270 ms
67,876 KB
testcase_22 AC 46 ms
50,432 KB
権限があれば一括ダウンロードができます

ソースコード

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