URAL 1885. Passenger Comfort (math AH)

Source: Internet
Author: User

Title Link: http://acm.timus.ru/problem.aspx?space=1&num=1885



1885. Passenger Comforttime limit:1.0 Second
Memory limit:64 MB
Marketing managers of the company Oceanic Airlines started a new advertising campaign. Its aim is 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. But the chief executive remembered quite, well, his ears had suffered during he last business trips to Bali with oceanic Airlines ... According to the instructions, the airplane must climb to an altitude of hmeters during the first TSeconds of the flight and keep that altitude during the whole flight. The climbing rate must isn't being greater than vMeters per second. The plane must not descend before the planned altitude is attained. The marketing managers wanted to know if their advertising is truthful. They found out this ears were blocked only when a plane is ascending at a rate of more than xMeters per second. Help the managers calculate the minimum and maximum amount of time during which passengers could have their ears blocked if The pilot adheres to the instructions. Assume that the plane can change it speed instantly. Inputthe only line contains the integers h, T, v, and x(5 000≤ h≤12 000; 50≤ T≤1 200; 1≤ x< v≤100; hT· v). Outputoutput-numbers, which is 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


The code is as follows:

#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 (math AH)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.