結果

問題 No.822 Bitwise AND
ユーザー siman
提出日時 2022-10-04 20:32:19
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 2,489 ms
コンパイル使用メモリ 142,332 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 09:17:36
合計ジャッジ時間 3,187 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#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