Tuesday, October 27, 2009

ACM ICPC Asia Manila 2009: Problem A

.
Link to blog post:
http://raffysaldana.blogspot.com/2009/10/acm-icpc-asia-manila-2009-problem.html

2009 ACM ICPC Asia Manila
October 22 – 23, 2009

Problem A: ‘Time Lapse Camera’
Input file: a.in
Output file: stdout
Execution time limit: 30 seconds

Henry has a time lapse camera that can take a set of 3 images in one shot. The three images are taken by the camera at different time lapse. For example, if the first image is taken at 0.33 seconds after the shot, then the second image is automatically taken at 0.51 seconds and the third image is taken at 0.62 seconds after the shot. The time lapses of taking the images are not reliable but the spatial coordinate (x, y) between images remain the same due to high speed shutter.

One nice evening during a sport festival, Henry placed a grid net in front of camera and started shooting the movement of a ball. Once the images were developed, Henry measured and recorded the coordinates of the ball on each image. Now he wants to know the highest height that the ball had achieved in a set of 3 images.

You need to help Henry by writing a program to compute the approximation of height that the ball has achieved in each set of images by assuming that the movement of the ball forms a parabolic curve.

Input

A test case consists of the coordinate of 3 points where the ball was captured by the camera. Input consists of several test cases. Each coordinate will not exceed 500.0 in absolute value. The input is terminated by a zero on a line by itself.

Output

Approximation of highest height that the ball has achieved in each test case

Sample Input

20, 25
50, 25
35, 30
15, 17
12, 23
16, 11
15, 12
25, 20
35, 25
0

Sample Output

Test case 1: 30.00
Test case 2: 23.25
Test case 3: 27.04


(Acknowledgment: This problem was contributed by Dr. Kardi Teknomo, Ateneo de Manila University)

.

No comments: