結果
問題 | No.1298 OR XOR |
ユーザー | ks2m |
提出日時 | 2020-11-27 21:27:04 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 630 bytes |
コンパイル時間 | 5,035 ms |
コンパイル使用メモリ | 73,468 KB |
実行使用メモリ | 57,272 KB |
最終ジャッジ日時 | 2023-10-01 04:39:58 |
合計ジャッジ時間 | 7,046 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 171 ms
56,560 KB |
testcase_01 | AC | 125 ms
55,856 KB |
testcase_02 | AC | 124 ms
55,980 KB |
testcase_03 | AC | 127 ms
55,996 KB |
testcase_04 | AC | 127 ms
56,108 KB |
testcase_05 | AC | 126 ms
55,952 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); } } }