結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kohaku_kohaku
提出日時 2016-12-02 16:16:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 464 ms / 5,000 ms
コード長 628 bytes
コンパイル時間 3,042 ms
コンパイル使用メモリ 73,688 KB
実行使用メモリ 59,284 KB
最終ジャッジ日時 2024-06-29 20:54:48
合計ジャッジ時間 8,156 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean [] dp = new boolean [16384*2+1];
        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]==true){
                    dp[j^A]=true;
                }
            }
        }
        int count=0;
        for(int j=0; j<dp.length; j++){
            if(dp[j]==true){
                count++;
            }
        }
        System.out.println(count);
    }
}
0