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. jquery validate 验证

    JSP中引入 <link href="themes/gray/easyui.css" rel="stylesheet" type="text/c ...

  2. GO数值和字符串的相互转换

    转自:http://blog.sina.com.cn/s/blog_9e14446a01018m9i.html 在做项目的时候,通常都会碰到字符串转换,在这介绍一下字符串与整型的相互转换.在golan ...

  3. QQ高仿版

    可在广域网部署运行的QQ高仿版 -- GG叽叽(源码)   前段时间看到园子里有朋友开发了QQ高仿版的程序,我也非常有兴趣,以前一直有个做即时聊天程序的梦,趁这段时间工作不是很忙,就开始动手来做这个事 ...

  4. CLR_Via_C#事件

    CLR_Via_C#学习笔记之事件   一:首先我先引用网上别人对事件的一些说明,然后将会通过一个事例进行对事件的演示: EventArgs是包含事件数据的类的基类,用于传递事件的细节.EventHa ...

  5. JS左侧菜单-02

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html xmlns=" ...

  6. .NET:国际化和本地化

    .NET:国际化和本地化 背景 国际化(i18n)和本地化(l10n)是高端程序的必备技术,可惜从业五年从没有尝试过,下一步准备做一个多用户的博客系统,想支持多语言,今天就学习了一下,写出来,希望大家 ...

  7. 持续集成环境Gitlab-CI的官方安装过程解析

    持续集成环境是一个非常重要的工具,在分工合作的项目中有着举足轻重的作用.公司最近要用Gitlab,需要配套的持续集成环境.研究了官方的文档,感觉官方的文档不是很明了.各种修改过后终于成功了.为了大家安 ...

  8. SSH使用技巧

    SSH使用技巧 SSH免输入密码 原理是依赖证书去认证,从而免除密码输入. 通过ssh-keygen生成一对公私钥,是否使用passphrase可以根据个人喜好.(其实使用证书就是为了方便而已,我是不 ...

  9. js 调用父窗口的方法

    opener.show(); 父窗体需要顶一个show() 方法 父面页代码: <!DOCTYPE HTML PUBLIC "-//IETF//DTD LEVEL1//EN" ...

  10. lucene 从2.4.0—3.6.0—4.3.1版本升级

    一.从2.4升级到3.6 替换原因:由于使用IBM的jdk导致了查询出现不稳定现象,原因无法找到,只好升级版本,毕竟版本很低 1)替换中文分词器,由原来的MMAnaylze替换为IKAnaylze 2 ...