結果

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

ソースコード

diff #

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

int main(){
    long long n,k;
    cin>>n>>k;

    if(n<k){
        cout<<"INF"<<endl;
        return 0;
    }

    long long ans=0;
    for(int i=110000;i>=0;i--){
        for(int j=0;j<=k;j++){
            if( i-j>=0 && (i&(i-j))==n){
                ans++;
                cerr<<i<<" "<<i-j<<endl;
            }
        }
    }
    cout<<ans<<endl;
    

    
}
0