Kattis- 3D Printed Statues

Posted 做一个AC梦

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kattis- 3D Printed Statues相关的知识,希望对你有一定的参考价值。

题目所述基本内容

You have a single 3D printer, and would like to use it to produce n statues. However, printing the statues one by one on the 3D printer takes a long time, so it may be more time-efficient to first use the 3D printer to print a new printer. That new printer may then in turn be used to print statues or even more printers. Print jobs take a full day, and every day you can choose for each printer in your possession to have it print a statue, or to have it 3D print a new printer (which becomes available for use the next day).

What is the minimum possible number of days needed to print at least n status?

输入输出样例

Input

The input contains a single integer n (1≤n≤10000), the number of statues you need to print.

Output

Output a single integer, the minimum number of days needed to print at least n status.

解题关键

找到一个最接近于n的且为2的x次方的数(x为大于等于0的整数)

代码

#include<iostream>
using namespace std;

int main() 
	int n;
	int count = 0;
	int num = 1;
	cin >> n;
	while (num < n) 
			num = num * 2;
			count = count + 1;
		
	cout << count+1<<endl;

结束语

好兄弟好兄弟,留下你的关注和点赞,666走一波!!!!!

以上是关于Kattis- 3D Printed Statues的主要内容,如果未能解决你的问题,请参考以下文章

Kattis, Kattis 的一些问题题解

Kattis, Kattis 的一些问题题解

微带天线读书计划:MICROSTRIP AND PRINTED ANTENNAS by Debatosh Guha in 2011

Sequelize 关联模型查询

freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above

Kattis-Beekeeper