結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-30 13:38:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 593 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 1,975 ms
コンパイル使用メモリ 71,532 KB
実行使用メモリ 60,328 KB
最終ジャッジ日時 2023-09-13 20:32:51
合計ジャッジ時間 9,122 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,552 KB
testcase_01 AC 123 ms
55,672 KB
testcase_02 AC 126 ms
55,932 KB
testcase_03 AC 125 ms
55,564 KB
testcase_04 AC 123 ms
55,728 KB
testcase_05 AC 125 ms
55,444 KB
testcase_06 AC 124 ms
55,988 KB
testcase_07 AC 593 ms
60,032 KB
testcase_08 AC 533 ms
60,188 KB
testcase_09 AC 440 ms
59,604 KB
testcase_10 AC 476 ms
60,328 KB
testcase_11 AC 548 ms
60,088 KB
testcase_12 AC 125 ms
55,584 KB
testcase_13 AC 118 ms
55,972 KB
testcase_14 AC 440 ms
60,076 KB
testcase_15 AC 556 ms
59,816 KB
testcase_16 AC 124 ms
55,492 KB
testcase_17 AC 266 ms
56,424 KB
testcase_18 AC 559 ms
59,780 KB
testcase_19 AC 219 ms
56,636 KB
権限があれば一括ダウンロードができます

ソースコード

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