結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2015-04-16 23:45:39 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 943 bytes |
コンパイル時間 | 3,643 ms |
コンパイル使用メモリ | 75,624 KB |
実行使用メモリ | 39,024 KB |
最終ジャッジ日時 | 2024-07-04 15:13:48 |
合計ジャッジ時間 | 6,779 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 RE * 3 |
ソースコード
import java.io.IOException; public class Main { public static void main(String[] args) throws Exception { int N = nextInt(); boolean[] a = new boolean[(1 << 14) + 1]; a[0] = true; for (int i = 0; i < N; i++) { a[nextInt()] = true; } for (int i = 1; i < a.length; i++) { if (!a[i]) { continue; } for (int j = 1; j < i; j++) { if (a[j]) { a[i ^ j] = true; } } } int ans = 0; for (int i = 0; i < a.length; i++) { if (a[i]) { ans++; } } System.out.println(ans); } static int nextInt() { int c; try { c = System.in.read(); while (c != '-' && (c < '0' || c > '9')) c = System.in.read(); if (c == '-') return -nextInt(); int res = 0; while (c >= '0' && c <= '9') { res = res * 10 + c - '0'; c = System.in.read(); } return res; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return -1; } }