結果

問題 No.2282 Boxed Nim
ユーザー ks2mks2m
提出日時 2023-04-28 21:26:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 2,750 ms
コンパイル使用メモリ 74,720 KB
実行使用メモリ 49,780 KB
最終ジャッジ日時 2024-04-28 23:07:26
合計ジャッジ時間 11,193 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,224 KB
testcase_01 AC 130 ms
41,356 KB
testcase_02 AC 128 ms
41,100 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 134 ms
41,112 KB
testcase_06 WA -
testcase_07 AC 130 ms
41,288 KB
testcase_08 AC 136 ms
41,288 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 588 ms
48,288 KB
testcase_15 AC 577 ms
48,220 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 654 ms
48,756 KB
権限があれば一括ダウンロードができます

ソースコード

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