結果
| 問題 |
No.822 Bitwise AND
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-02-14 17:53:41 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 660 bytes |
| コンパイル時間 | 2,088 ms |
| コンパイル使用メモリ | 74,428 KB |
| 実行使用メモリ | 51,164 KB |
| 最終ジャッジ日時 | 2024-06-25 18:18:57 |
| 合計ジャッジ時間 | 3,926 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
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[] first = br.readLine().split(" ", 2);
int n = Integer.parseInt(first[0]);
int k = Integer.parseInt(first[1]);
if (n < k) {
System.out.println("INF");
return;
}
int max = 1;
while (n >= max) {
max = max << 1;
}
int count = 0;
for (int i = n; i <= max; i++) {
for (int j = i; j - i <= k; j++) {
if ((i & j) == n) {
count++;
}
}
}
System.out.println(count);
}
}
htensai