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. journaling保证意外故障下的数据完整性

    mongoDB研究笔记:journaling保证意外故障下的数据完整性   mongoDB的Journaling日志功能与常见的log日志是不一样的,mongoDB也有log日志,它只是简单记录了数据 ...

  2. 冒泡动画按钮的简单实现(使用CSS3)

    冒泡动画按钮的简单实现(使用CSS3) 原始的参考文章是 http://tutorialzine.com/2010/10/css3-animated-bubble-buttons/ ,基本原理是利用了 ...

  3. 配置restful webservice 框架restkit

    (配置restful webservice 框架restkit) RestKit 是一个开源的 objective-c 框架,容许在 iOS 和 Mac OS X 的 Objective-C 中与 R ...

  4. 编译linux内核时出错

    在编译linux内核的时候使用make menuconfig 可能出现下面的错误 *** Unable to find the ncurses libraries or the*** required ...

  5. NodeJS系列-部署

    NodeJS系列-部署 NodeJS我就不介绍了,被标题吸引进来的人可以看这个链接,了解NodeJS.下来就开始关于NodeJS开发的指南. NodeJS可以部署的平台有Windows,Unix,iO ...

  6. Android Chronometer控件使用,计时器

    Android Chronometer实现了一个简单的计时器,继承自TextView,因此可以使用TextView的text控制属性来控制时间显示的颜色.字体大小等:可以定义时间显示格式,默认“MM: ...

  7. 【Oracle】-【体系结构】-【DBWR】-DBWR进程相关理解

    对DBWR的一些理解 首先从名称上,DBWR全称是Database Writer Process,属于Oracle后台进程的一种,有的地方也叫DBWn,我想这里是出于DBWR进程个数的原因,DBWR进 ...

  8. 【Cocos2d-X开发学习笔记】第05期:渲染框架之布景层类(CCLayer)的使用

    本系列学习教程使用的是cocos2d-x-2.1.4版本(截至目前为止最新稳定版) ,PC开发环境Windows7,C++开发环境VS2010 图层也是渲染框架中很重要的内容.场景类用来划分游戏的状态 ...

  9. [置顶] 如何高效使用和管理Bitmap--图片缓存管理模块的设计与实现

    传送门 ☞ 轮子的专栏 ☞ 转载请注明 ☞ http://blog.csdn.net/leverage_1229 上周为360全景项目引入了图片缓存模块.因为是在Android4.0平台以上运作,出于 ...

  10. Hamilton

    import java.util.Vector; class Hamilton { int start; int a[][]; int len; int x[]; // 记录回路 boolean fl ...