#include<iostream>
#include<cstdio>
using namespace std;
int a[36], b[36];
int n, x, y, index, ans;
int main(){
scanf("%d%d", &n, &x);
for(int i = 0; i < n; ++i){
scanf("%d", &y);
if((x|y) > x) continue;
index = 0;
while(y){
a[index++] += y&1;
y >>= 1;
}
}
index = 0;
while(x){
b[index++] = x&1;
x >>= 1;
}
ans = 0x3f3f3f3f;
for(int i = 0; i < 35; ++i) if(b[i]) ans = min(ans, a[i]);
if(ans == 0x3f3f3f3f) ans = 0;
printf("%d\n", ans);
return 0;
}
1315 合法整数集
最新推荐文章于 2021-10-20 10:49:49 发布