Problem Description
Who is Dylans?You can find his ID in UOJ and Codeforces. His another ID is s1451900 in BestCoder.
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.
 
Input
In the first line there is a number T.
T is the test number.
In the next T lines there is a number N.
0≤N≤1018,T≤1000
 
Output
For each test case,output an answer.
 
Sample Input
1
5
 
Sample Output
2
 #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的更多相关文章

  1. hdu 5272 Dylans loves numbers

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5272 Dylans loves numbers Description Who is Dylans?Y ...

  2. hdu 5272 Dylans loves numbers 水题

    Dylans loves numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem. ...

  3. HDU 5273 Dylans loves numbers(水题)

    题意:给出一个0≤N≤1018,求其二进制中有几处是具有1的,假设相连的1只算1处,比如1101011就是3处. 思路:一个个数,当遇到第一个1时就将flag置为1:当遇到0就将flag置为0.当遇到 ...

  4. hdu 5273 Dylans loves sequence

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5273 Dylans loves sequence Description Dylans is give ...

  5. hdu 5274 Dylans loves tree

    Dylans loves tree http://acm.hdu.edu.cn/showproblem.php?pid=5274 Time Limit: 2000/1000 MS (Java/Othe ...

  6. hdu 5274 Dylans loves tree(LCA + 线段树)

    Dylans loves tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Othe ...

  7. hdu 5274 Dylans loves tree (树链剖分 + 线段树 异或)

    Dylans loves tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Othe ...

  8. AC日记——Dylans loves tree hdu 5274

    Dylans loves tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Othe ...

  9. HDU 5274 Dylans loves tree 树链剖分+线段树

    Dylans loves tree Problem Description Dylans is given a tree with N nodes. All nodes have a value A[ ...

随机推荐

  1. SQL Server 如何读写数据

    01. SQL Server 如何读写数据   一. 数据读写流程简要SQL Server作为一个关系型数据库,自然也维持了事务的ACID特性,数据库的读写冲突由事务隔离级别控制.无论有没有显示开启事 ...

  2. spring.net AOP通知类型

    上篇介绍了spring.net AOP的基本实现,其中有说到通知类型,首先在这里补充解释一下.最后出一个异常通知的实例,因为他的实现和别的通知有些不一样. 1.拦截环绕通知:在Spring中最基础的通 ...

  3. jquery animate stop函数解析

    今天我们来看看jquery中动画操作的stop函数.其实我至今不是很明白啊,所以此文算是求救以及抛砖引玉. 在jquery 1.7版本以前,stop支持两个参数,分别是clearQueue和jumpT ...

  4. asp.net mvc4设置area里面使用相同的 Controller 名称并设置area里的页面为起始页

    asp.net mvc4设置area里面使用相同的 Controller 名称并设置area里的页面为起始页 1.使用重名controller 在asp.net mvc2以后的版本里面,有了area( ...

  5. CentOS 安装 Mogodb(在线 && 离线)

    平台之大势何人能挡? 带着你的Net飞奔吧!http://www.cnblogs.com/dunitian/p/4822808.html 先说推荐安装:在线安装,跟着官方走可以避免一些问题 新学Mon ...

  6. 一张图让你快速学会UML(聚合、组合、依赖、继承、接口、类)

    有朋友反映,一上来直接讲设计模式就算理解了,也不知道如何画出类图,那么我们就通过一张图,来图解如何应用UML正确表示类与类之间的关系. 这张图完整讲述了鸟类的生存. 首先是类:在UML中,我们用分成三 ...

  7. 【汇编语言】DEBUG的使用

    在masm for windows中,需要先生存exe文件,然后再点调试按钮. 常用的命令有: R命令:查看.改变CPU寄存器的内容:如果要修改某个寄存器的内容,可以在r的后面接上空格和寄存器名.如: ...

  8. ASP.NET网站运行常见错误以及解决方法(持续更新)

    一.A potentially dangerous Request.Form value was detected from the client 用户在页面上提交表单到服务器时,服务器会检测到一些潜 ...

  9. Mac下使用charles遇到的问题以及解决办法

    最近使用上了Charles,因为之前一直使用Fidder,所以还是碰到了一些问题,这里记录一下. 如何安装破解版 打开charles后,发现访问但是抓不到包 抓取HTTPS的接口,看response是 ...

  10. java转发和重定向

    1,请求重定向:客户端行为,response.sendRedirect(),从本质上讲等同于两次请求,前一次的请求对象不会保持,地址栏的URL地址会改变.2,请求转发:服务器行为,request.ge ...