結果

問題 No.822 Bitwise AND
ユーザー xuzijian629xuzijian629
提出日時 2019-04-26 21:42:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 200,068 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-03 21:48:14
合計ジャッジ時間 2,950 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 57 ms
5,376 KB
testcase_05 AC 24 ms
5,376 KB
testcase_06 AC 41 ms
5,376 KB
testcase_07 AC 57 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 33 ms
5,376 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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 0;
    }
    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