| 比赛 | 20140713下午练习 | 评测结果 | AAAAAAAAAA |
|---|---|---|---|
| 题目名称 | 比特 | 最终得分 | 100 |
| 用户昵称 | slyrabbit | 运行时间 | 0.114 s |
| 代码语言 | C++ | 内存使用 | 0.31 MiB |
| 提交时间 | 2014-07-13 16:17:29 | ||
#include<iostream>
#include<cstdio>
using namespace std;
unsigned int n;
int main()
{
freopen("bita.in","r",stdin);
freopen("bita.out","w",stdout);
int s=0;
cin>>n;
for(int i=1;i<=n;i++)
{
unsigned int x=i;
bool t=false;
while(x>0)
{
if((x&1)&&t==true)
{
s++;
}
if((x&1)&&t==false)
{
t=1;
}
if((x&1)==0)
t=0;
x>>=1;
}
}
cout<<s;
return 0;
}