結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2019-11-26 08:03:24 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 772 bytes |
コンパイル時間 | 4,578 ms |
コンパイル使用メモリ | 74,316 KB |
実行使用メモリ | 57,776 KB |
最終ジャッジ日時 | 2024-11-06 05:41:09 |
合計ジャッジ時間 | 6,787 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 WA * 5 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); boolean[][] arrays = new boolean[n][]; for (int i = 0; i < n; i++) { arrays[i] = getBinary(sc.nextInt()); } long total = 1; for (int i = 0; i < 16; i++) { boolean hasTrue = false; for (int j = 0; j < n; j++) { if (arrays[j][i]) { hasTrue = true; break; } } if (hasTrue) { total *= 2; } } System.out.println(total); } static boolean[] getBinary(int x) { boolean[] ans = new boolean[16]; for (int i = 0; i < ans.length; i++) { ans[i] = (x % 2 == 1); x /= 2; } return ans; } }