标签:well worm 虫子 英语翻译 climbing 打卡 minute out
An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats. How long before the worm climbs out of the well? We'll always count a portion of a minute as a whole minute and if the worm just reaches the top of the well at the end of its climbing, we'll assume the worm makes it out.
一只一英寸的虫子在n英寸深的井里。它每分钟可以爬u英寸。但是每爬一分钟之后,它需要休息一分钟。休息期间,它滑落d英寸。循环往复。什么时候虫子才能爬出井呢?虫子到达井的顶部时,就算是完成了。
输入:
There will be multiple problem instances. Each line will contain 3 positive integers n, u and d. These give the values mentioned in the paragraph above. Furthermore, you may assume d < u and n < 100. A value of n = 0 indicates end of output.
每行输入n,u,d的值,以输入n=0结束输入。
输出:
Each input instance should generate a single integer on a line, indicating the number of minutes it takes for the worm to climb out of the well.
每行应单独输出整数。整数即虫子爬出水井需要的时间。
标签:well,worm,虫子,英语翻译,climbing,打卡,minute,out 来源: https://blog.csdn.net/m0_63365528/article/details/122725036
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。