結果
| 問題 |
No.822 Bitwise AND
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-01 22:23:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 55 ms / 2,000 ms |
| コード長 | 447 bytes |
| コンパイル時間 | 716 ms |
| コンパイル使用メモリ | 65,920 KB |
| 最終ジャッジ日時 | 2025-01-12 12:54:49 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <iostream>
void solve() {
int n, k;
std::cin >> n >> k;
if (n + 1 <= k) {
std::cout << "INF\n";
return;
}
int ans = 0;
for (int x = 0; x <= n * 2; ++x) {
for (int d = 0; d <= k; ++d) {
if ((x & (x + d)) == n) ++ans;
}
}
std::cout << ans << "\n";
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}