cf467B Fedor and New Game
发布日期:2021-08-15 22:29:32 浏览次数:34 分类:技术文章

本文共 1702 字,大约阅读时间需要 5 分钟。

 

B. Fedor and New Game
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».

The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are numbered form 1 to (m + 1). Types of soldiers are numbered from 0 to n - 1. Each player has an army. Army of the i-th player can be described by non-negative integer xi. Consider binary representation of xi: if the j-th bit of number xi equal to one, then the army of the i-th player has soldiers of the j-th type.

Fedor is the (m + 1)-th player of the game. He assume that two players can become friends if their armies differ in at most k types of soldiers (in other words, binary representations of the corresponding numbers differ in at most k bits). Help Fedor and count how many players can become his friends.

Input

The first line contains three integers nmk (1 ≤ k ≤ n ≤ 20; 1 ≤ m ≤ 1000).

The i-th of the next (m + 1) lines contains a single integer xi (1 ≤ xi ≤ 2n - 1), that describes the i-th player's army. We remind you that Fedor is the (m + 1)-th player.

Output

Print a single integer — the number of Fedor's potential friends.

Sample test(s)
input
7 3 18511117
output
0
input
3 3 31234
output
3

 

sb题*2

给m个数,转成二进制,问和给定的x的每一位异或和小等于k的有多少个

#include
#include
#include
using namespace std;int n,m,k,ans,a[100100];int work(int x){ int res=0; for(int i=0;i<=21;i++) if((x&(1<
<

  

转载于:https://www.cnblogs.com/zhber/p/4035989.html

转载地址:https://blog.csdn.net/weixin_30781107/article/details/97122695 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:试水贴!!!!
下一篇:Sitecore CMS中删除项目

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2024年03月09日 20时04分50秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

Android网络期末考,Android 面试之「网络基础篇」 2021-06-24
html如何修改按钮样式,css怎么设置按钮样式? 2021-06-24
nextcloud如何填写数据库_OMV利用Docker配置nextcloud,实现个人网盘的搭建! 2021-06-24
点击定位到指定位置_使用Word书签功能轻松定位到指定位置或某个特定内容 2021-06-24
图像控制点 形变_几何校正中控制点的选取.doc 2021-06-24
cpu超线程优缺点_今天看了下百度百科!看到了超线程的优缺点啊!转! 2021-06-24
python2和3安装后怎样切换 mac_Mac下安装配置Python2和Python3并相互切换使用 2021-06-24
python错误代码40035_python-(matplotlib.pyplot)散点图轴的顺序错误 2021-06-24
java servlet 返回 web_javaWEB之Servlet 2021-06-24
att格式汇编指令_汇编语言学习笔记(目录) 2021-06-24
项目创建venv、_阅读源码 - django-admin.py startproject是怎么创建项目的? 2021-06-24
5 关掉调试_火灾自动报警系统调试详细程序及步骤,看看你掌握了多少 2021-06-24
查看dataloader的大小_一文弄懂Pytorch的DataLoader, DataSet, Sampler之间的关系 2021-06-24
ttcam 怎么用_婴儿不喝水怎么办啊?怎样才可以让婴儿喝水呢? 2021-06-24
经纬度5位数和6位数差多少_经纬度精度差别 - Rain - OSCHINA - 中文开源技术交流社区... 2021-06-24
markdown如何调整行距_Markdown 技巧:如何改变表格宽度(列宽)? 2021-06-24
dumpbin是什么意思_PE文件加密处理. 2021-06-24
2733软件_FTP客户端工具:SmartFTP Client Enterprise 9.0.2733 便携版 2021-06-24
cef 提高加载速度_怎么提高电脑网速?加快电脑浏览器网页加载速度的方法 2021-06-24
element tree 可以新增修改删除_一起学Vue:UI框架(element-ui) 2021-06-24