首页 > 其他 > 详细

URAL 1885. Passenger Comfort(数学啊 )

时间:2015-03-08 10:29:10      阅读:193      评论:0      收藏:0      [点我收藏+]

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1885



1885. Passenger Comfort

Time limit: 1.0 second
Memory limit: 64 MB
Marketing managers of the company Oceanic Airlines started a new advertising campaign. Its aim was to emphasize the comfort of the passengers on board. However, when the board of directors watched the first commercial shot for the campaign, some questions appeared. The commercial ended with the catchy slogan “Oceanic Airlines. Blocked ears. Choose one of the two.” But the chief executive remembered quite well how his ears had suffered during his last business trip to Bali with Oceanic Airlines…
According to the instructions, the airplane must climb to an altitude of h meters during the first tseconds of the flight and keep that altitude during the whole flight. The climbing rate must not be greater than v meters per second. The plane must not descend before the planned altitude is attained.
The marketing managers wanted to know if their advertising was truthful. They found out that ears were blocked only when a plane was ascending at a rate of more than x meters per second. Help the managers calculate the minimum and maximum amount of time during which passengers may have their ears blocked if the pilot adheres to the instructions. You may assume that the plane can change its speed instantly.

Input

The only line contains the integers htv, and x (5 000 ≤ h ≤ 12 000; 50 ≤ t ≤ 1 200; 1 ≤ x <v ≤ 100; h ≤ t · v).

Output

Output two real numbers, which are the minimum and maximum numbers of seconds during which passengers may have their ears blocked. The absolute or relative error of each number should not exceed 10?6.

Sample

input output
10000 500 50 10
125.0 500.0


代码如下:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
    int h, t, v, x;
    double minn, maxx;
    while(~scanf("%d%d%d%d",&h,&t,&v,&x))
    {
        int tt = t*x;
        if(tt >= h)
        {
            minn = 0;
            maxx = h/(x*1.0);
        }
        else
        {
            minn = (h-x*t*1.0)/(v-x);
            maxx = t;
        }
        printf("%lf %lf\n",minn,maxx);
    }
    return 0;
}



URAL 1885. Passenger Comfort(数学啊 )

原文:http://blog.csdn.net/u012860063/article/details/44131193

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!