Description
  赏金猎人在追捕他的猎物。已知当前赏金猎人与猎物相距s米,赏金猎人每秒移动a米,猎物每秒移动c米。赏金猎人有一个技能追踪术,使用后,他的移动速度将会变为每秒移动b米(b>a),使用该技能需要持续施法t秒,持续施法期间,赏金猎人不能移动。请问,赏金猎人最快需要多长时间才能追上猎物(与猎物距离为0时视为追上)。

Input
多组数据。
每组5个整数,s,a,b,c,t (1 <= s <= 1000,1<=a < b <= 100,1 <= c <= 100,1 <= t <= 10)。含义见题目。

Output
输出一个数,赏金猎人追上猎物所需最短时间,保留6位小数。若无法追上,输出-1。

Sample Input
10 1 2 1 1
10 1 2 3 1
Sample Output
12.000000
-1
HINT

代码C:

#include <stdio.h>
#define _MAX 65535

int main(int argc, const char * argv[])
{
    int s, a, b, c, t;
    double timeOne, timeTwo, time;
    while (scanf("%d %d %d %d %d", &s, &a, &b, &c, &t) != EOF)
    {
        timeOne = _MAX;
        timeTwo = _MAX;
        if (a > c)
        {
            timeOne = s * 1.0 / (a - c);
        }
        if (b > c)
        {
            timeTwo = (s + c * t) * 1.0 / (b - c) + t;
        }
        time = timeOne > timeTwo ? timeTwo : timeOne;
        if (time == _MAX)
        {
            printf("-1\n");
        }
        else
        {
            printf("%.6f\n", time);
        }
    }
    return 0;
}
这道题是我见过的最水的acm题,有点贪心算法的感觉,只用考虑两种情况,要么不使用技能,要么一开始就使用技能,看看哪个更快,这样子就好了。