10773 - Back to Intermediate Math

# include <bits/stdc++.h>
int main()
{
    int t,i;
    double min_time,min_dist,d,v,u,sum;
    scanf("%d",&t);
    for(i=1;i<=t;i++)#include <stdio.h>
#include <math.h>

int main()
{   int u,v,d;
    int i,cases;
    scanf("%d",&cases);
    for(i=0;i<cases;i++){
        scanf("%d %d %d",&d,&v,&u);
        if(u==0 ||v==0 ||u<=v)
            printf("Case %d: can't determine\n",i+1);
        else{
            double t1=0,t2=0;
            t1=d*1.0/u;
            t2=d*1.0/sqrt(u*u-v*v);
            printf("Case %d: %.3f\n",i+1,t2-t1);
        }
    }
       return 0;
    }
    {
        scanf("%lf %lf %lf",&d,&v,&u);
           if(v>=u)
           printf("Case %d: can't determine\n",i);
           else
           {
        min_time = d/u;
        min_dist = d/sqrt(u*u-v*v);

        if(min_dist==min_time )
        printf("Case %d: can't determine\n",i);
        else
        printf("Case %d: %.3lf\n",i, fabs(min_dist-min_time)+1e-12);
           }
    }
SHARE

Amit Ghosh

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment