結果

問題 No.2282 Boxed Nim
ユーザー ks2m
提出日時 2023-04-28 21:26:09
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 1,913 ms
コンパイル使用メモリ 74,416 KB
実行使用メモリ 61,968 KB
最終ジャッジ日時 2024-11-17 20:26:53
合計ジャッジ時間 10,045 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 11
権限があれば一括ダウンロードができます

ソースコード

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();

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