結果

問題 No.822 Bitwise AND
ユーザー xuzijian629xuzijian629
提出日時 2019-04-26 21:43:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 495 bytes
コンパイル時間 1,873 ms
コンパイル使用メモリ 202,160 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 22:08:46
合計ジャッジ時間 2,693 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 RE -
testcase_04 AC 52 ms
6,940 KB
testcase_05 AC 21 ms
6,944 KB
testcase_06 AC 37 ms
6,940 KB
testcase_07 AC 53 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 RE -
testcase_15 AC 29 ms
6,940 KB
testcase_16 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    if (k == 0) {
        cout << 1 << endl;
        return 0;
    }
    if (n <= k) {
        cout << "INF" << endl;
        return 1;
    }
    int cnt = 0;
    for (int i = 0; i <= n << 1; i++) {
        for (int j = i; j <= i + k; j++) {
            if ((i & j) == n) {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}
0