結果
| 問題 |
No.939 and or
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-01-18 19:17:03 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 631 bytes |
| コンパイル時間 | 2,042 ms |
| コンパイル使用メモリ | 74,276 KB |
| 実行使用メモリ | 37,204 KB |
| 最終ジャッジ日時 | 2024-06-28 01:15:19 |
| 合計ジャッジ時間 | 4,636 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 WA * 5 |
ソースコード
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]);
if ((a & b) != a) {
System.out.println(0);
return;
}
int count = 0;
int c = b - a;
while (c > 0) {
count += c % 2;
c /= 2;
}
System.out.println((long)(Math.pow(2, count - 1)));
}
}
htensai