CF148B.Escape
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The princess is going to escape the dragon's cave, and she needs to plan it carefully.
The princess runs at v__p miles per hour, and the dragon flies at v__d miles per hour. The dragon will discover the escape after t hours and will chase the princess immediately. Looks like there's no chance to success, but the princess noticed that the dragon is very greedy and not too smart. To delay him, the princess decides to borrow a couple of bijous from his treasury. Once the dragon overtakes the princess, she will drop one bijou to distract him. In this case he will stop, pick up the item, return to the cave and spend f hours to straighten the things out in the treasury. Only after this will he resume the chase again from the very beginning.
The princess is going to run on the straight. The distance between the cave and the king's castle she's aiming for is c miles. How many bijous will she need to take from the treasury to be able to reach the castle? If the dragon overtakes the princess at exactly the same moment she has reached the castle, we assume that she reached the castle before the dragon reached her, and doesn't need an extra bijou to hold him off.
公主正计划逃离恶龙的洞穴,她需要谨慎地制定逃亡方案。
公主的奔跑速度为 vp 英里/小时,而恶龙的飞行速度为 vd 英里/小时。恶龙将在 t 小时后发现公主的逃亡,并立即开始追击。看起来她毫无成功希望,但公主注意到恶龙非常贪婪且不太聪明。为了延缓恶龙的追击,公主决定从恶龙的宝库中借走几件宝珠(bijous)。一旦恶龙追上公主,她便会丢下一颗宝珠以分散其注意力。此时,恶龙会停下、拾起宝珠、飞回洞穴,并花费 f 小时整理宝库中的物品。只有完成这一切后,他才会重新从洞穴出发,再次开始追击。
公主将沿一条直线逃跑。洞穴与她所要抵达的国王城堡之间的距离为 c 英里。她需要从宝库中带走多少颗宝珠,才能确保自己成功抵达城堡?若恶龙恰好在公主抵达城堡的同一时刻追上她,则我们认为公主已先于恶龙到达城堡,无需额外使用一颗宝珠来阻拦恶龙。
输入格式
The input data contains integers v__p, v__d, t, f and c, one per line (1 ≤ v__p, v__d ≤ 100, 1 ≤ t, f ≤ 10, 1 ≤ c ≤ 1000).
输入数据包含整数 vp、vd、t、f 和 c,每行一个(1 ≤ vp, vd ≤ 100,1 ≤ t, f ≤ 10,1 ≤ c ≤ 1000)。
输出格式
Output the minimal number of bijous required for the escape to succeed.
输出成功逃脱所需的最少宝石数量。
输入输出样例
输入#1
1 2 1 1 10
输出#1
2
输入#2
1 2 1 1 8
输出#2
1
说明/提示
In the first case one hour after the escape the dragon will discover it, and the princess will be 1 mile away from the cave. In two hours the dragon will overtake the princess 2 miles away from the cave, and she will need to drop the first bijou. Return to the cave and fixing the treasury will take the dragon two more hours; meanwhile the princess will be 4 miles away from the cave. Next time the dragon will overtake the princess 8 miles away from the cave, and she will need the second bijou, but after this she will reach the castle without any further trouble.
The second case is similar to the first one, but the second time the dragon overtakes the princess when she has reached the castle, and she won't need the second bijou.
第一种情况:逃逸一小时后,龙会发现此事,此时公主距离洞穴已有 1 英里;两小时后,龙将在距离洞穴 2 英里的地方追上公主,公主需丢下第一颗宝石。龙返回洞穴并修复宝库需再耗时两小时;在此期间,公主将抵达距离洞穴 4 英里的位置。随后,龙将在距离洞穴 8 英里的地方再次追上公主,公主需丢下第二颗宝石;此后她将顺利抵达城堡,不再遇到任何麻烦。
第二种情况与第一种类似,但龙第二次追上公主时,公主恰好已抵达城堡,因此她无需丢下第二颗宝石。
输入解题思路,AI测评打分。不知道怎么写?