結果
問題 | No.1298 OR XOR |
ユーザー | ks2m |
提出日時 | 2020-11-27 21:31:33 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 630 bytes |
コンパイル時間 | 4,016 ms |
コンパイル使用メモリ | 74,512 KB |
実行使用メモリ | 56,852 KB |
最終ジャッジ日時 | 2023-10-01 04:52:58 |
合計ジャッジ時間 | 8,145 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 154 ms
56,560 KB |
testcase_01 | AC | 131 ms
55,552 KB |
testcase_02 | AC | 116 ms
55,744 KB |
testcase_03 | AC | 116 ms
55,896 KB |
testcase_04 | AC | 118 ms
55,700 KB |
testcase_05 | AC | 117 ms
55,852 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); int a = 0; int b = 0; int c = 0; int cnt = 0; for (int i = 0; i < 31; i++) { if ((n >> i & 1) == 1) { cnt++; if (cnt == 1) { a += 1 << i; b += 1 << i; } else if (cnt == 2) { a += 1 << i; c += 1 << i; } else { a += 1 << i; b += 1 << i; c += 1 << i; } } } if (cnt <= 1) { System.out.println("-1 -1 -1"); } else { System.out.println(a + " " + b + " " + c); } } }