結果
問題 | No.822 Bitwise AND |
ユーザー |
|
提出日時 | 2019-04-26 22:03:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 521 bytes |
コンパイル時間 | 1,633 ms |
コンパイル使用メモリ | 166,284 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 18:12:42 |
合計ジャッジ時間 | 2,387 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll N, K; cin >> N >> K; if (N + 1 <= K) { cout << "INF" << endl; return 0; } int ans = 0; ll p = 1LL; while (p < N) {p *= 2;} for (ll y = N; y <= p; ++y){ if ((y & N) != N) continue; for (ll x = max(N, y - K); x <= y; ++x){ if ((x & y) == N) {++ans;} } } cout << ans << endl; return 0; }