-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUVA 10773.cpp
38 lines (37 loc) · 925 Bytes
/
UVA 10773.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<stdio.h>
#include<math.h>
int main()
{
int t,i;
double d,v,u,fastest,shortest_velocity,cos,shortest;
scanf("%d",&t);
for(i=1; i<=t; i++)
{
fastest=0,shortest_velocity=0,shortest=0,cos=0;
scanf("%lf%lf%lf",&d,&v,&u);
cos=-(v/u);
shortest_velocity=u*sqrt(1-(cos*cos));
fastest=d/u;
shortest=d/shortest_velocity;
if(v!=u)
{
if(fastest>shortest)
{
printf("Case %d: %.3lf\n",i,fastest-shortest);
}
else if(shortest>fastest)
{
printf("Case %d: %.3lf\n",i,shortest-fastest);
}
else
{
printf("Case %d: can't determine\n",i);
}
}
else
{
printf("Case %d: can't determine\n",i);;
}
}
return 0;
}