1006 Questions:
Problem Description
The three hands of the clock is rotating every second and meeting all other many times everyday. Finally, they get bored of this and all of the them would like to stay away from the other. A Hand is happy if it's at least D degrees from any of the rest. You is to calculate what much time in a day and all the hands is happy.
Input
The input contains many test cases. Each of them have a single line with a real number D between 0 and inclusively. The input is terminated with a D of-1.
Output
For each D, print in a, the percentage of time, a, and all of the hands is happy, accurate up to 3 DECIM Al places.
Sample Input
012090-1
Sample Output
100.000 0.000 6.251
Ideas:
Requirements: The interval between the hour, minute, and second hand is greater than the total time of an angle (which is entered by the user) for the total time of the day.
This can be understood as:
1. We only need to work out the clock from 12 o'clock full (3 pointers coincident), to the next 12 o'clock full (3 pointers again coincident) This 12 hours of time, the interval between the 3 pointers is greater than the time to set the angle (that is, the number of seconds).
2. Since it is the number of seconds, we can count the 12 hours, that is, in 720 minutes, the number of seconds per minute, the position of the 3 pointers meet the requirements.
3. Thus, we calculate the angle at which the 3 pointers deviate from the 12 o'clock full position at the moment of h:m:s (H-minute S-second) (because it is convenient to calculate the relative angular difference of the 3 pointers, i.e. the interval of their distance):
First: The angular velocity of these 3 pointers:
- #define V_SEC 6.0//second hand angular speed: 6 degrees per second
- #define V_MIN 0.1//minute corner speed: 0.1 degrees per second
- #define V_hou 1.0/120//angular speed: 1/120 degrees per second
Then: These 3 pointers deviate from the 0 point angle:
- #define A_SEC s*6//second hand angle: 6*s
- #define A_min m*6+s*0.1//minute hand angle: 0.1 degrees *60s*m minutes +0.1 degrees *s seconds
- #define A_hou h*30+m*0.5+s/120.0//hour angle: 1/120 degrees *3600s*h hours +1/120 degrees *60s*m minutes +1/120*s seconds
4.
1006 Tick and tick