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. Leapin' Lizards

    Leapin' Lizards 题目大意: 在一个网格地图中有一些高度不同的石柱,一些石柱上站着一些蜥蜴,你的任务是让尽量多的蜥蜴逃到边界外. 每行每列中相邻石柱的距离为1,蜥蜴的跳跃距离是d,即蜥蜴 ...

  2. 利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句

    利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句 (喷血分享)利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句 在我们RDIFram ...

  3. Thrift RPC实战(一).初次体验Thrift

    1.前言: Thrift作为Facebook开源的RPC框架, 通过IDL中间语言, 并借助代码生成引擎生成各种主流语言的rpc框架服务端/客户端代码,主要特点: 开发速度快: 通过编写RPC接口ID ...

  4. Tapestry5.3使用总结

    1.Tapestry框架的加载是通过Filter来完成的,需要在web.xml中加入以下配置: <filter> <filter-name>app</filter-nam ...

  5. 2440裸机驱动之PWM开发

    原文http://blog.chinaunix.net/uid-14114479-id-3125685.html ARM驱动蜂鸣器的方式有两种:一种是PWM输出口直接驱动,另一种是利用IO定时翻转电平 ...

  6. lll

    //// whywhy unsigned int T = 1; ~T = 4294967294; T = 2;~T= 4294967293 ;T = 0;~T=4294967295; int T = ...

  7. samba安装与配置

    1.安装软件包rpm -q samba samba-common samba-client cifs-utilsyum -y install samba samba-common samba-clie ...

  8. 结构-行为-样式-Bootstrap笔记

    1.自上而下的内容布局,中间内容可变,应该用: <div class=" container-fluid"> <div class=" row" ...

  9. Cordova环境搭建与hello word

    一.环境下载 1.下载并安装Node.js 安装一路下一步即可 2.下载并安装Git 安装一路下一步即可 3.配置Android开发平台环境 (1)下载JDK (2)下载AndroidSDK (3)下 ...

  10. 典型关联分析(CCA)原理总结

    典型关联分析(Canonical Correlation Analysis,以下简称CCA)是最常用的挖掘数据关联关系的算法之一.比如我们拿到两组数据,第一组是人身高和体重的数据,第二组是对应的跑步能 ...