UVALive -4579
Description Henry has a time lapse camera that can take a set of 3 images inone shot. The three images are taken by the camera at differenttime lapse. For example, if the first image is taken at 0.33seconds after the shot, then the second image is automaticallytaken at 0.51 seconds and the third image is taken at 0.62 secondsafter the shot. The time lapses of taking the images are notreliable but the spatialcoordinate One nice evening during a sport festival, Henry placed a gridnet in front of camera and started shooting the movement of a ball.Once the images were developed, Henry measured and recorded thecoordinates of the ball on each image. Now he wants to know thehighest height that the ball had achieved in a set of 3 images. You need to help Henry by writing a program to compute theapproximation of height that the ball has achieved in each set ofimages by assuming that the movement of the ball forms a paraboliccurve. Input
A test case consists of the coordinate of 3 points where theball was captured by the camera. Input consists of several testcases. Each coordinate will not exceed 500.0 in absolute value. Theinput is terminated by a zero on a line by itself. Output
Approximation of highest height that the ball has achieved ineach test case SampleInput
20, 25 50, 25 35, 30 15, 17 12, 23 16, 11 15, 12 25, 20 35, 25 0 SampleOutput
Test case 1: 30.00 Test case 2: 23.25 Test case 3: 27.04 #include<stdio.h> int main() {
char p;
int k=1;
double a,b,c,x1,x2,x3,y1,y2,y3; while(~scanf("%lf",&x1))
{
if(!x1) break; else
scanf("%c%lf",&p,&y1); scanf("%lf, %lf",&x2,&y2);
}
return 0;
|
UVALive 4579 Time Lapse Camera
最新推荐文章于 2024-08-31 08:59:16 发布