首页 > 代码库 > codeforces Fedor and New Game

codeforces Fedor and New Game

#include<iostream>#include<stack>#include<cstring>#include<cstdio>#include<queue>#include<vector>#include<algorithm>#define INF 0x3f3f3f3fusing namespace std;int a[1005];int main(){    int n, m, k;    int ans, ret=0;    scanf("%d%d%d", &n, &m, &k);    for(int i=1; i<=m; ++i)        scanf("%d", &a[i]);    scanf("%d", &ans);    for(int i=1; i<=m; ++i){        int tmp = ans^a[i], cnt=0;        while(tmp){            if(tmp&1) ++cnt;            tmp>>=1;        }        if(cnt<=k)  ++ret;    }     printf("%d\n", ret);    return 0;}

 

codeforces Fedor and New Game