結果
| 問題 | No.822 Bitwise AND |
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-02-14 17:53:41 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 2,000 ms |
| コード長 | 660 bytes |
| 記録 | |
| コンパイル時間 | 1,954 ms |
| コンパイル使用メモリ | 82,516 KB |
| 実行使用メモリ | 45,748 KB |
| 最終ジャッジ日時 | 2026-03-12 03:47:34 |
| 合計ジャッジ時間 | 3,755 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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