結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー YamaKasaYamaKasa
提出日時 2018-07-27 19:36:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 596 ms / 5,000 ms
コード長 582 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 71,660 KB
実行使用メモリ 60,724 KB
最終ジャッジ日時 2023-09-13 18:55:32
合計ジャッジ時間 9,290 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
54,412 KB
testcase_01 AC 133 ms
55,940 KB
testcase_02 AC 133 ms
55,752 KB
testcase_03 AC 132 ms
56,216 KB
testcase_04 AC 130 ms
56,120 KB
testcase_05 AC 133 ms
55,900 KB
testcase_06 AC 131 ms
56,148 KB
testcase_07 AC 458 ms
60,632 KB
testcase_08 AC 561 ms
60,360 KB
testcase_09 AC 463 ms
59,708 KB
testcase_10 AC 510 ms
60,620 KB
testcase_11 AC 579 ms
60,496 KB
testcase_12 AC 134 ms
56,132 KB
testcase_13 AC 125 ms
56,096 KB
testcase_14 AC 383 ms
59,972 KB
testcase_15 AC 596 ms
60,724 KB
testcase_16 AC 131 ms
56,276 KB
testcase_17 AC 283 ms
57,100 KB
testcase_18 AC 445 ms
60,480 KB
testcase_19 AC 242 ms
57,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int max = (int)Math.pow(2, 15);
		int []dp = new int[max + 1];
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int []A = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
			dp[A[i]] = 1;
		}
		scan.close();
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < max; j++) {
				if(dp[j] != 0) {
					dp[A[i] ^ j] = 1;
				}
			}
		}
		int cnt = 0;
		for(int i = 0; i < max; i++) {
			if(dp[i] != 0) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}
0