Saturday, November 5, 2016

1311 - Unlucky Bird

Problem Linkhttp://lightoj.com/volume_showproblem.php?problem=1311

Solution

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    scanf("%d",&t);
    double v1,v2,v3,a1,a2,t1,t2,d,ans,s1,s2;

    for(int ca=1;ca<=t;ca++)
    {
        scanf("%lf%lf%lf%lf%lf",&v1,&v2,&v3,&a1,&a2);

        s1=(v1*v1)/(2.0*a1);
        s2=(v2*v2)/(2.0*a2);

        d=s1+s2;

        t1=v1/a1;
        t2=v2/a2;

        t1=max(t1,t2);

        ans=v3*t1;

        printf("Case %d: %f %f\n",ca,d,ans);

    }

}

No comments:

Post a Comment