結果

問題 No.822 Bitwise AND
ユーザー simansiman
提出日時 2022-10-04 20:32:19
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 4,477 ms
コンパイル使用メモリ 104,940 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-28 21:14:12
合計ジャッジ時間 5,443 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 15 ms
4,384 KB
testcase_05 AC 7 ms
4,380 KB
testcase_06 AC 10 ms
4,384 KB
testcase_07 AC 15 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 9 ms
4,384 KB
testcase_16 AC 2 ms
4,388 KB
権限があれば一括ダウンロードができます

ソースコード

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