Submit | All submissions | Best solutions | Back to list |
MEETING - Hands meeting |
Wersja polska | English version |
Given the hour, calculate the minimum number of minutes that a clock needs so that it's hands were in the same position.
Input
There is unknown number of tests. Each of them consist of two integers: h and m which represent the starting hour (0<h<25, 0<=m<60).
Output
For each test print the minimal number of minutes which the clock needs so that it's hands were in the same position.
Example
Input:
3 0
12 0
17 47
15 15
8 44
13 6
Output:
16
0
46
1
0
65
Added by: | Piotr Kąkol |
Date: | 2010-11-09 |
Time limit: | 11.14s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: SCM qobi |
hide comments
|
|||||
2010-11-15 10:22:33 Konstantin
hello. No, I am still not convinced :-) I'm sorry I think I did not make myself clear. Why is rounding better? I can see that 16.36 is approximately equal to 16 (obviously) but why is it necessary to round this value at all? why don't we just find an answer an round(or ceil or whatever) it instead? e.g. for 8 44: hands meet at 08h 43.636m and at 09h 49.09m. Since 44>43.636m than the next time the hand meet will be 09:49.09 so we find the difference: 09:49.09 - 08:44 = 1:05.09 = 1:05 = 65m make sense? thanks |
|||||
2010-11-12 23:41:24 Piotr KÄ…kol
Unblocked. Write if there are any doubts. |
|||||
2010-11-12 22:24:52 numerix
I see no reason to block submissions. You explained it and gave an example. |
|||||
2010-11-12 13:43:39 Piotr KÄ…kol
Maybe this picture will make all clear: Write if You still don't understand. :-) PS Debanjan, could You look here? Last edit: 2010-11-12 16:07:12 |
|||||
2010-11-12 13:23:05 :(){ :|: & };:
The problem statement doesn't seem much understandable to me,you could try explaining at-least one test case :-) |
|||||
2010-11-12 13:02:30 Piotr KÄ…kol
In my opinion rounding is better than ceil so for: 8 44 8h 43.(63)m is 8h 44m so answer=0m (because hands meet approximately at 8h44m); and for: 13 6 13h 5.(45)m is 13h 5m so answer=65m (because hands meet at 13h5m and it's 13h6m so they need 65minutes more). Did I convince You? This task will be blocked until these controvelsial examples are understood. |
|||||
2010-11-11 13:37:18 Konstantin
Hello, I think the last two test results are quite controversial. 8 44 Literally, the clock hands meet when it's 08h 43.636m so 44m is a bit too late and the right answer is not 0. 13 6 The hands meet when it's 13h 5.45m. The same situation as above here but we treat it correctly. It does not make sense to round the hands meeting time(43.636 to 44 and 5.45 to 5). It should be ceiled instead, I suppose. Thanks. |