結果

問題 No.822 Bitwise AND
ユーザー kappybarkappybar
提出日時 2020-04-20 21:08:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 553 bytes
コンパイル時間 1,468 ms
コンパイル使用メモリ 163,916 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-08 01:15:00
合計ジャッジ時間 2,328 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    int n,k;
    cin >> n >> k;
    if(n+1 <= k){
        cout << "INF" << endl;
        return 0;
    }
    ll ans = 0;
    int res = 1;
    while(res < n) res *= 2;
    for(int x=n;x<=res;x++){
        if((x & n) != n) continue;
        for(int y=x;y<=x+k;y++){
            if((x & y) == n) ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}
0