結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー tsunabittsunabit
提出日時 2020-03-11 16:29:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 657 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 4,533 ms
コンパイル使用メモリ 79,692 KB
実行使用メモリ 47,564 KB
最終ジャッジ日時 2024-07-03 00:02:42
合計ジャッジ時間 12,126 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

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