結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kou6839kou6839
提出日時 2015-04-27 01:06:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 2,882 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 2,066 ms
コンパイル使用メモリ 72,884 KB
実行使用メモリ 63,408 KB
最終ジャッジ日時 2023-09-18 12:38:50
合計ジャッジ時間 17,947 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,708 KB
testcase_01 AC 125 ms
55,892 KB
testcase_02 AC 162 ms
55,892 KB
testcase_03 AC 136 ms
56,084 KB
testcase_04 AC 131 ms
55,780 KB
testcase_05 AC 177 ms
57,968 KB
testcase_06 AC 126 ms
55,732 KB
testcase_07 AC 2,882 ms
63,408 KB
testcase_08 AC 1,428 ms
60,316 KB
testcase_09 AC 1,032 ms
60,668 KB
testcase_10 AC 1,139 ms
60,484 KB
testcase_11 AC 1,628 ms
60,204 KB
testcase_12 AC 192 ms
58,248 KB
testcase_13 AC 126 ms
55,760 KB
testcase_14 AC 222 ms
59,384 KB
testcase_15 AC 1,507 ms
61,144 KB
testcase_16 AC 131 ms
55,760 KB
testcase_17 AC 564 ms
60,328 KB
testcase_18 AC 2,136 ms
63,336 KB
testcase_19 AC 423 ms
59,848 KB
権限があれば一括ダウンロードができます

ソースコード

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