結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kenkooookenkoooo
提出日時 2015-04-17 23:59:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,484 ms / 5,000 ms
コード長 587 bytes
コンパイル時間 1,947 ms
コンパイル使用メモリ 73,048 KB
実行使用メモリ 60,484 KB
最終ジャッジ日時 2023-09-11 11:06:52
合計ジャッジ時間 16,348 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
56,376 KB
testcase_01 AC 135 ms
56,416 KB
testcase_02 AC 224 ms
56,004 KB
testcase_03 AC 152 ms
56,616 KB
testcase_04 AC 132 ms
56,060 KB
testcase_05 AC 402 ms
56,252 KB
testcase_06 AC 144 ms
56,332 KB
testcase_07 AC 1,484 ms
60,484 KB
testcase_08 AC 813 ms
60,152 KB
testcase_09 AC 803 ms
59,708 KB
testcase_10 AC 797 ms
60,112 KB
testcase_11 AC 791 ms
60,204 KB
testcase_12 AC 1,304 ms
56,104 KB
testcase_13 AC 127 ms
55,784 KB
testcase_14 AC 212 ms
59,344 KB
testcase_15 AC 1,302 ms
60,064 KB
testcase_16 AC 160 ms
56,480 KB
testcase_17 AC 1,320 ms
57,060 KB
testcase_18 AC 1,482 ms
60,008 KB
testcase_19 AC 1,303 ms
56,744 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();
		boolean[] dp = new boolean[1 << 14 + 1];
		for (int i = 0; i < N; i++) {
			dp[sc.nextInt()] = true;
		}
		sc.close();

		for (int i = 0; i < dp.length; i++) {
			if (!dp[i]) {
				continue;
			}
			for (int j = 0; j < dp.length; j++) {
				if (dp[j]) {
					dp[i ^ j] = true;
				}
			}
		}

		int ans = 0;
		for (int i = 0; i < dp.length; i++) {
			if (dp[i]) {
				ans++;
			}
		}
		System.out.println(ans);

	}
}
0