結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hhgfhn1
提出日時 2018-10-30 13:38:24
言語 Java
(openjdk 23)
結果
AC  
実行時間 569 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 74,936 KB
実行使用メモリ 58,744 KB
最終ジャッジ日時 2024-07-01 05:02:01
合計ジャッジ時間 9,045 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		int a[]=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=scanner.nextInt();
		}
		boolean dp[]=new boolean[1<<14+1];
		dp[0]=true;
		for(int i=0;i<n;i++) {
			for(int j=0;j<1<<14+1;j++) {
				if(dp[j]) {
					dp[j^a[i]]=true;
				}
			}
		}
		int cnt=0;
		for(int i=0;i<1<<14+1;i++) {
			if(dp[i])cnt++;
		}
		System.out.println(cnt);
	}
}
0