codeforces Fedor and New Game

简介:
#include<iostream>
#include<stack>
#include<cstring>
#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
#define INF 0x3f3f3f3f
using 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;
}









本文转自 小眼儿 博客园博客,原文链接:http://www.cnblogs.com/hujunzheng/p/3980499.html,如需转载请自行联系原作者
目录
相关文章
LeetCode 390. Elimination Game
给定一个从1 到 n 排序的整数列表。 首先,从左到右,从第一个数字开始,每隔一个数字进行删除,直到列表的末尾。 第二步,在剩下的数字中,从右到左,从倒数第一个数字开始,每隔一个数字进行删除,直到列表开头。 我们不断重复这两步,从左到右和从右到左交替进行,直到只剩下一个数字。 返回长度为 n 的列表中,最后剩下的数字。
73 0
LeetCode 390. Elimination Game
|
存储 算法
LeetCode 289. Game of Life
如果活细胞周围八个位置的活细胞数少于两个,则该位置活细胞死亡; 如果活细胞周围八个位置有两个或三个活细胞,则该位置活细胞仍然存活; 如果活细胞周围八个位置有超过三个活细胞,则该位置活细胞死亡; 如果死细胞周围正好有三个活细胞,则该位置死细胞复活;
49 0
LeetCode 289. Game of Life
codeforces327——A. Flipping Game(前缀和)
codeforces327——A. Flipping Game(前缀和)
63 0
|
人工智能
Codeforces 839B Game of the Rows【贪心】
B. Game of the Rows time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output...
1136 0
|
Java
HDU 5882 Balanced Game
Balanced Game Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 508    Accepted Submission(s): ...
816 0