結果
| 問題 | No.822 Bitwise AND |
| コンテスト | |
| ユーザー |
37zigen
|
| 提出日時 | 2019-04-26 22:03:47 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 2,000 ms |
| コード長 | 655 bytes |
| 記録 | |
| コンパイル時間 | 1,722 ms |
| コンパイル使用メモリ | 83,356 KB |
| 実行使用メモリ | 49,612 KB |
| 最終ジャッジ日時 | 2026-03-12 03:42:56 |
| 合計ジャッジ時間 | 3,530 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().run();
}
void run() throws Exception {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long K = sc.nextLong();
if (N + 1 <= K) {
System.out.println("INF");
return;
}
int max = 1;
while (max <= N)
max *= 2;
max -= 1;
long ans = 0;
for (long y = N; y <= max; ++y) {
for (long x = Math.max(0, y - K); x <= y; ++x)
if ((x & y) == N) {
++ans;
}
}
System.out.println(ans);
}
void tr(Object... objects) {
System.out.println(Arrays.deepToString(objects));
}
}
37zigen