escape

The princess is going to escape the dragon's cave, and she needs to plan it carefully.

The princess runs at vp miles per hour, and the dragon flies at vd 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.

Input

The input data contains integers vp, vd, t, f and c, one per line (1 ≤ vp, vd ≤ 100, 1 ≤ t, f ≤ 10, 1 ≤ c ≤ 1000).

Output

Output the minimal number of bijous required for the escape to succeed.

Sample Input

Input
1
2
1
1
10
Output
2
Input
1
2
1
1
8
Output
1


公主将要逃出龙的洞穴,她需要精心策划。


公主以每小时VP英里的速度运行,而龙以每小时英里每小时的速度飞行。龙将发现在T小时后的逃逸,并立即追逐公主。看起来好像没有成功的机会,但是公主注意到龙很贪婪,也不太聪明。拖延他,公主决定从他的财政借几比茹斯。一旦龙追的公主,她会掉落宝石来分散他的注意力。在这种情况下,他会停下来,捡起物品,回到洞穴,花上几个小时把金库里的东西清理干净。只有这样,他才能从一开始就重新开始追赶。


公主马上就要跑了。山洞和国王城堡的距离是C英里。有多少比茹斯将她需要从财政部能够到达城堡吗?如果龙将公主就在她已经到了城堡,我们以为她在龙达她到达城堡,而不需要额外的宝石来拖住他。(必须用double)

#include <iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
    double vp,vd,t,f,c,t1,s1,x,t2,t3,s2,s3,t4;
    int sum=0;
    scanf("%lf%lf%lf%lf%lf",&vp,&vd,&t,&f,&c);
    x=c;
    sum=0;
    if(vp>=vd||vp*t>=c)
        printf("0\n");
    else
    {
        s1=vp*t;
        c-=s1;
        if(c<=0)
            ;
        else
        {
            t2=s1/(vd-vp);
            s2=t2*vp;
            c-=s2;//c=8;
            if(c<=0)
                ;
            else
            {
                sum+=1;
                for(;;)
                {
                    t2=(x-c)/vd;//1s
                    t4=f;//1s
                    s2=(t2+t4)*vp;//s2=2
                    c-=s2;//c=6
                    if(c<=0)
                        break;
                    t3=(x-c)/(vd-vp);//t3=4
                    s3=t3*vp;//s3=4
                    c-=s3;//c=2
                    if(c<=0)
                        break;
                    sum+=1;
                }
            }
        }

        printf("%d\n",sum);
    }

}










  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值