結果

問題 No.822 Bitwise AND
コンテスト
ユーザー siman
提出日時 2022-10-04 20:32:19
言語 C++17(clang)
(clang++ 23.1.4 + boost 1.92.0 + ACL)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 11 ms / 2,000 ms
+ 185µs
コード長 549 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,026 ms
コンパイル使用メモリ 139,612 KB
実行使用メモリ 9,828 KB
最終ジャッジ日時 2026-10-16 16:06:56
合計ジャッジ時間 3,730 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;

  if (N < K) {
    cout << "INF" << endl;
  } else {
    ll ans = 0;

    for (int y = N; y <= 2 * N; ++y) {
      for (int i = 0; i <= K; ++i) {
        int x = y + i;
        if ((y & x)  == N) ++ans;
      }
    }

    cout << ans << endl;
  }

  return 0;
}
0