結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-23 22:06:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 656 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 3,552 ms
コンパイル使用メモリ 71,852 KB
実行使用メモリ 62,168 KB
最終ジャッジ日時 2023-09-12 00:54:34
合計ジャッジ時間 10,976 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,020 KB
testcase_01 AC 126 ms
55,964 KB
testcase_02 AC 126 ms
56,096 KB
testcase_03 AC 127 ms
55,692 KB
testcase_04 AC 128 ms
56,092 KB
testcase_05 AC 129 ms
56,124 KB
testcase_06 AC 128 ms
56,524 KB
testcase_07 AC 656 ms
62,168 KB
testcase_08 AC 572 ms
60,420 KB
testcase_09 AC 470 ms
60,052 KB
testcase_10 AC 504 ms
60,252 KB
testcase_11 AC 578 ms
60,412 KB
testcase_12 AC 130 ms
56,080 KB
testcase_13 AC 121 ms
55,992 KB
testcase_14 AC 487 ms
59,196 KB
testcase_15 AC 629 ms
60,868 KB
testcase_16 AC 127 ms
55,960 KB
testcase_17 AC 272 ms
57,060 KB
testcase_18 AC 583 ms
60,320 KB
testcase_19 AC 226 ms
56,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise114{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    boolean[] dp = new boolean[1 << 15];
    dp[0] = true;
    for(int i = 0; i < n; i++){
      int a = sc.nextInt();
      for(int j = 0; j < dp.length; j++){
        if(!dp[j]){
          continue;
        }
        dp[a ^ j] = true;
      }
    }
    int answer = 0;
    for(int i = 0; i < dp.length; i++){
      if(dp[i]){
        answer++;
      }
    }
    System.out.println(answer);
  }
}
0