Problem 2062 Suneast & Yayamao

Accept: 143    Submit: 313
Time Limit: 1000 mSec    Memory Limit : 32768 KB

 Problem Description

Yayamao is so cute that people loves it so much.

Everyone wants to buy Yayamao from Suneast (a business man who sells Yayamao).

Suneast is a strange business man. He sells Yayamao in a random price from 1, 2, 3, 4, 5…, n.

Suneast is also a lazy business man. He never looks for a change. But people can’t but Yayamao with a lower price, that say people must pay exact money for Yayamao.

Now, we want to know how many pieces of money people should bring with to buy a Yayamao with the exactly price.

 Input

There are multiple test cases. Each test case has an integer n(1<=n<=2147483647) in a single line.

 Output

For each case, output a single integer in a line indicate the number of pieces of money people should bring with to buy a Yayamao whose price is random from 1 to n.

 Sample Input

1 2 5

 Sample Output

1 2 3

 Hint

In test case 1: people can bring 1 piece of money: 1

In test case 2: people can bring 2 pieces of money: (1, 1) or (1, 2)

In test case 3: people can bring 3 pieces of money: (1, 1, 3) or (1, 2, 2) ….

 #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
int n,sum;
while(cin>>n)
{
sum=;
while(n)
{
n>>=;
sum++;
}
cout<<sum<<endl;
}
}

最新文章

  1. Andriod学习笔记2:“Your content must have a ListView whose id attribute is &#39;android.R.id.list&#39;”问题的解决办法
  2. Uva1398 Meteor
  3. Filestream复制视频文件
  4. GRE词汇3-4 +
  5. 简述 Ruby 与 DSL 在 iOS 开发中的运用
  6. 设置textView或者label的行间距方法
  7. mysql tcp 4层负载
  8. cocos2d-x3.0数据结构
  9. 顺序表----java实现
  10. 团队开发冲刺2-----1day
  11. java的logcat的简单使用
  12. Oracle_SQL92_连接查询
  13. Web前端学习(4):显示图片、url与文件路径
  14. oracle数据库密码过期修改注意事项
  15. Difference between hash() and id()
  16. Vue学习目录
  17. 最短路(SPFA)
  18. Fiddler抓包使用教程-基本功能介绍
  19. Git中使用amend解决提交冲突
  20. 40. Linux下7-zip解压到当前目录的命令

热门文章

  1. [REST] 1.REST的起源
  2. C++栈和堆的生长方向
  3. 02-TypeScript中新的字符串
  4. webpack2学习日志
  5. svn to git
  6. group by 多字段分组
  7. 用GDI+画验证码
  8. 201521123091 《Java程序设计》第2周学习总结
  9. 201521123009 《Java程序设计》第6周学习总结
  10. 如何将ubuntu文件夹中文名改为英文