結果

問題 No.822 Bitwise AND
ユーザー sugarrrsugarrr
提出日時 2019-04-26 21:51:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,059 bytes
コンパイル時間 1,603 ms
コンパイル使用メモリ 167,620 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 22:20:36
合計ジャッジ時間 2,295 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

int main(){fastio
    
    ll n,k;cin>>n>>k;
    if(n==0){
        if(k==0)cout<<1<<endl;
        else cout<<"INF"<<endl;
        return 0;
    }
    ll N=1<<11;
    ll ans=0;
    n=n%N;
    rep(i,0,N-1){
        rep(j,i,N-1){
            if((i&j)!=n)continue;
            if(j-i<=k)ans++;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}

0