F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Jumping Hands

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 272    Accepted Submission(s): 113


Problem Description
In Shanghai, there are some famous clock towers built more than 100 years ago, such as the office building of Shanghai Customs, Xujiahui Church, etc. Every clock tower¡¯s clock-face consists of three hands: an hour hand, a minute hand, and a second hand. The hands do not move smoothly as time passing. When a second passes, the hands jump to the next place clockwise: the second hand moves 1/60 ring, the minute hand moves 1/3600 ring and the hour hand moves 1/43200 ring.

We assume that every hand¡¯s mass is evenly distributed, and its thickness can be ignored. In other words, every hand¡¯s centre of gravity is at the middle position of the respective hand. Suppose p1, p2 and p3 are, respectively, the position of the centre of gravity of the hour hand, that of the minute hand, and that of the second hand. The position of all three hands¡¯ centre of gravity, P, is the average of p1, p2 and p3 weighted by the hands¡¯ mass.

Suppose P1 and P2 are the positions of the three hands¡¯ centre of gravity at the start time and at the end time, respectively. Your task is to calculate the length of the path from P1 to P2. That is, if P3 is the position of the three hands¡¯ centre of gravity on the clock-face at a point of time between start time and end time, X is the length of the path from P1 to P3, and Y is the length of the path from P3 to P2, the length of the path from P1 to P2 is X+Y.
 

Input
Input consists of one or more lines, each line describing one data set. Each line begins with 6 integers: L1, L2, L3, M1, M2, M3, followed by start time and end time. L1, L2 and L3 indicate the lengths of hour hand, minute hand and second hand respectively, where 1¡ÜL1<L2<L3¡Ü100. M1, M2 and M3 indicate the weights of hour hand, minute hand and second hand respectively, where 1¡ÜM1, M2, M3¡Ü100. The format of start time and end time is hh:mm:ss, where 0¡Ühh¡Ü23, 0¡Ümm¡Ü59, and 0¡Üss¡Ü59. Start time and end time should be in the same day.

End of input is indicated by a line consisting of -1.
 

Output
For each data set, output a single line. Each line should give the length of the path for the positions of three hands¡¯ centre of gravity at the start time and at the end time. The precision should be 10-2.
 

Sample Input
1 2 3 1 2 3 00:00:00 00:00:01 3 4 5 1 1 1 09:00:00 18:00:00 -1
 

Sample Output
0.08 2826.27
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 18:08:25, Gzip enabled