結果
問題 | No.939 and or |
ユーザー |
![]() |
提出日時 | 2020-01-18 19:09:33 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 713 bytes |
コンパイル時間 | 1,914 ms |
コンパイル使用メモリ | 74,496 KB |
実行使用メモリ | 52,332 KB |
最終ジャッジ日時 | 2024-06-28 01:02:30 |
合計ジャッジ時間 | 4,794 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 18 |
ソースコード
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" ", 2); int a = Integer.parseInt(line[0]); int b = Integer.parseInt(line[1]); int count = 0; while (a > 0 && b > 0) { if (a % 2 == 0 && b % 2 == 1) { count++; } else if (a % 2 == 1 && b % 2 == 0) { System.out.println(0); return; } a /= 2; b /= 2; } System.out.println((long)(Math.pow(2, count - 1))); } }