結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kou6839
提出日時 2015-04-27 01:06:40
言語 Java
(openjdk 23)
結果
AC  
実行時間 2,392 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 2,054 ms
コンパイル使用メモリ 75,256 KB
実行使用メモリ 51,012 KB
最終ジャッジ日時 2024-07-05 03:27:31
合計ジャッジ時間 16,898 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args){
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Set<Integer> set = new HashSet<>();
		set.add(0);
		for(int i=0;i<n;i++){
			int t = sc.nextInt();
			ArrayList<Integer> al = new ArrayList<>();
			for(Integer j:set){
				int waa=t^j;
				if(!set.contains(waa))al.add(waa);
			}
			for(int ss:al) set.add(ss);
		}
		System.out.println(set.size());
	}
}
0