結果
問題 | No.1298 OR XOR |
ユーザー |
![]() |
提出日時 | 2020-11-30 18:21:25 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 612 bytes |
コンパイル時間 | 2,692 ms |
コンパイル使用メモリ | 76,300 KB |
実行使用メモリ | 55,240 KB |
最終ジャッジ日時 | 2024-09-13 02:28:15 |
合計ジャッジ時間 | 6,127 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 WA * 5 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int count = getCount(n); if (count <= 1) { System.out.println("-1, -1, -1"); return; } int a = 1; while ((n & a) == 0) { a <<= 1; } System.out.println(a + " " + (n ^ a) + " " + n); } static int getCount(int x) { int count = 0; while (x > 0) { count += x % 2; x /= 2; } return count; } }