Dylans loves numbers
And now today's problems are all about him.
Dylans is given a number N. He wants to find out how many groups of "1" in its Binary representation.
If there are some "0"(at least one)that are between two "1", then we call these two "1" are not in a group,otherwise they are in a group.
T is the test number.
In the next T lines there is a number N.
0≤N≤1018,T≤1000
5
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
__int64 n;int i,j,k,ans,flag,t;
while(scanf("%d",&t)!=EOF)
{
while(t--)
{
scanf("%I64d",&n);
ans=;flag=;
while(n)
{
k=n%;n/=;
if(k==)
{
if(flag==)
ans++;
flag=;
}
else
{
flag=;
}
}
cout<<ans<<endl;
}
}
return ;
}
Dylans loves numbers的更多相关文章
- hdu 5272 Dylans loves numbers
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5272 Dylans loves numbers Description Who is Dylans?Y ...
- hdu 5272 Dylans loves numbers 水题
Dylans loves numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem. ...
- HDU 5273 Dylans loves numbers(水题)
题意:给出一个0≤N≤1018,求其二进制中有几处是具有1的,假设相连的1只算1处,比如1101011就是3处. 思路:一个个数,当遇到第一个1时就将flag置为1:当遇到0就将flag置为0.当遇到 ...
- hdu 5273 Dylans loves sequence
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5273 Dylans loves sequence Description Dylans is give ...
- hdu 5274 Dylans loves tree
Dylans loves tree http://acm.hdu.edu.cn/showproblem.php?pid=5274 Time Limit: 2000/1000 MS (Java/Othe ...
- hdu 5274 Dylans loves tree(LCA + 线段树)
Dylans loves tree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Othe ...
- hdu 5274 Dylans loves tree (树链剖分 + 线段树 异或)
Dylans loves tree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Othe ...
- AC日记——Dylans loves tree hdu 5274
Dylans loves tree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Othe ...
- HDU 5274 Dylans loves tree 树链剖分+线段树
Dylans loves tree Problem Description Dylans is given a tree with N nodes. All nodes have a value A[ ...
随机推荐
- iphone手机用wireshark抓包
ios连上电脑 查看udid. 启动虚拟接口 rvictl -s 7e65eeaa55a1e43dbdfb44a02f9871f1f304043e 打开mac权限 sudo chmod 644 /de ...
- javac命令
javac命令 javac命令初窥 注:以下红色标记的参数在下文中有所讲解. 用法: javac <options> <source files> 其中, 可能的选项包括: ...
- network重启失败原因
/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE='eth0' eth0后面千万不能加空格之类的
- 计算机就是用命换的行业,多干一年程序猿,寿命将减少2年,干20年的编程苦力,基本60岁之前你就要OVER了
if c++==python:(869710179) 2013-7-6 10:21:31 计算机本来就是用命换的行业 爱笑的眼睛(373213735) 2013-7-6 10:21:55 if c ...
- 揭开Html 标签的面纱,忘不了的html .
Html :(Hypertext MarkupLanguage),是用于描述网页文档的一种标记语言,是一种标准,它通过标记符号来标记要显示的网页中的各个部分.其本身是一种文本文件,通过在文本文件中添 ...
- 设置RichEdit相关颜色说明
1.设置RichEdit客户区的背景颜色 要设置RichEdit的背景色,需要发送 EM_SETBKGNDCOLOR 消息给RichEdit控件,关于该消息的说明:wParam参数 为颜色选项,如果是 ...
- 框架基础:ajax设计方案(三)---集成ajax上传技术
之前发布了ajax的通用解决方案,核心的ajax发布请求,以及集成了轮询.这次去外国网站逛逛,然后发现了ajax level2的上传文件,所以就有了把ajax的上传文件集成进去的想法,ajax方案的l ...
- 利用GeneratedKeyHolder获得新增数据主键值
Spring利用GeneratedKeyHolder,提供了一个可以返回新增记录所对应的主键值的方法: int update(PreparedStatementCreator psc, KeyHold ...
- Fragment与Activity交互(使用接口)
在Fragment中: 1. // 定义一个回调接口,该Fragment所在Activity需要实现该接口// 该Fragment将通过该接口与它所在的Activity交互 { public void ...
- IDEA异常解决: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
有时候解决问题不仅仅是解决问题.-----jstarseven 最近因为开发需要,需要搭建一个ssm开发框架,采用了开发工具IDEA. 整合完了SSM开发框架之后,发布的时候出现org.apache. ...