結果

問題 No.822 Bitwise AND
ユーザー betrue12
提出日時 2019-04-26 21:37:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 1,506 ms
コンパイル使用メモリ 166,756 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 18:10:47
合計ジャッジ時間 2,426 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N, K;
    cin >> N >> K;
    if(N < K){
        cout << "INF" << endl;
        return 0;
    }

    int64_t ans = 0;
    int MX = 1<<17;
    for(int k=0; k<=K; k++) for(int x=0; x<MX; x++) if((x & (x+k)) == N) ans++;
    cout << ans << endl;
    return 0;
}
0