Snail’s trouble |
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
Total Submission(s): 79 Accepted Submission(s): 54 |
Problem Description
Once upon a time, there was a poor snail. Every day, it tried very hard to crawl forward, while there was a keeper who’d like to maltreat this poor little snail. The snail was crawling on a one-meter rubber band at first, and it can move on k cm every minute. But after that, the keeper stretches the rubber band quickly, and it would be elongated one meter, during that the distances ratio between the snail and the two endpoints remain unchanged. In the next minute, little snail tried to keep moving forward again.
“Can I finally get to the endpoint?” The snail often asked himself such a question because he was afraid he would never succeed. Now, we hope you can tell this poor snail when he would reach the endpoint. |
Input
Every line of the input contains an integer number k, indicating that the snail moved forward k cm every minute. (5 <= k <= 100)
|
Output
Output an integer t, indicating that the snail doesn’t get to the endpoint until t-1 minutes later, while t minutes later, it finally succeed.
|
Sample Input
10 100 |
Sample Output
12367 1 |
Source
2009 Multi-University Training Contest 2 - Host by TJU
|
Recommend
gaojie
题意 :有一只蜗牛在一个一米长的跑道上,每分钟爬k厘米,跑道每分钟增加1米,但是蜗牛与跑道两端的比率还是不变的。求蜗牛多少时间到达终点。
设 总跑道长度为1, 第 n 分钟走过的长度为 (k/100)*(1 / n),对,没错,所以可以求解了
|
HDU 2832-Snail’s trouble(分治)
最新推荐文章于 2020-01-25 09:58:17 发布