結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー htensaihtensai
提出日時 2019-12-30 10:24:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 533 ms / 5,000 ms
コード長 673 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 71,576 KB
実行使用メモリ 60,976 KB
最終ジャッジ日時 2023-09-15 19:42:13
合計ジャッジ時間 9,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,312 KB
testcase_01 AC 126 ms
56,072 KB
testcase_02 AC 127 ms
56,040 KB
testcase_03 AC 127 ms
56,240 KB
testcase_04 AC 126 ms
55,788 KB
testcase_05 AC 130 ms
55,840 KB
testcase_06 AC 128 ms
56,180 KB
testcase_07 AC 493 ms
60,428 KB
testcase_08 AC 475 ms
60,584 KB
testcase_09 AC 393 ms
59,984 KB
testcase_10 AC 424 ms
60,832 KB
testcase_11 AC 474 ms
60,072 KB
testcase_12 AC 126 ms
56,160 KB
testcase_13 AC 121 ms
56,040 KB
testcase_14 AC 447 ms
59,192 KB
testcase_15 AC 533 ms
60,976 KB
testcase_16 AC 127 ms
56,268 KB
testcase_17 AC 251 ms
56,992 KB
testcase_18 AC 462 ms
60,560 KB
testcase_19 AC 214 ms
56,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = (int)(Math.pow(2, 15));
        boolean[] dp = new boolean[count];
        dp[0] = true;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            for (int j = 0; j < count; j++) {
                if (dp[j]) {
                    dp[j ^ a] = true;
                }
            }
        }
        int ans = 0;
        for (int i = 0; i < count; i++) {
            if (dp[i]) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}
0