What time is it if the second hand is exactly on a second mark, and exactly 18 second marks ahead of the hour hand?
"no error" because the first trial, with the second hand straight up, gives the correct answer: 8:24.
There are 60 possible positions for the second hand, 0 through 59 seconds past the latest minute. By the conditions of the problem, this places the hour hand on a particular positon 18/60 of a circle back on the clockface (or 42/60 ahead, so as not to consider negative positions). The number of hours past 12 (or zero) is the second (aka minute) position of the hour hand divided by 5, so the time in seconds would be the position of the hour hand divided by 5 and multiplied by 3600 for the number of seconds in an hour.
If that time of day, now converted to seconds is in fact the seconds position assumed, the given time is the answer.
As it happens, this occurs when the second hand is actually straight up, zero seconds past the integral minute. The hour hand is then at the 42 mark for minutes or seconds, 18 units before the second hand.
DEFLNG A-Z
CLS
FOR i = 0 TO 59
t = i
t2 = t MOD 60
t2 = t2 - 18: IF t2 < 0 THEN t2 = t2 + 60 ' seconds pos of hr hand
t2 = t2 * (3600 / 5)
ts = t2 ' time in seconds
t2 = t2 MOD 60
IF t = t2 THEN
h = ts \ 3600: ts = ts - h * 3600
m = ts \ 60: ts = ts - m * 60
PRINT h; ":"; m; ":"; ts, t, t - t2
END IF
NEXT
If the IF ... END IF were removed, you'd get
Time sec hand at discr. diff from 18
8 : 24 : 0 0 0
8 : 36 : 0 1 1
8 : 48 : 0 2 2
9 : 0 : 0 3 3
9 : 12 : 0 4 4
9 : 24 : 0 5 5
9 : 36 : 0 6 6
9 : 48 : 0 7 7
10 : 0 : 0 8 8
10 : 12 : 0 9 9
10 : 24 : 0 10 10
10 : 36 : 0 11 11
10 : 48 : 0 12 12
11 : 0 : 0 13 13
11 : 12 : 0 14 14
11 : 24 : 0 15 15
11 : 36 : 0 16 16
11 : 48 : 0 17 17
0 : 0 : 0 18 18
0 : 12 : 0 19 19
0 : 24 : 0 20 20
0 : 36 : 0 21 21
0 : 48 : 0 22 22
1 : 0 : 0 23 23
1 : 12 : 0 24 24
1 : 24 : 0 25 25
1 : 36 : 0 26 26
1 : 48 : 0 27 27
2 : 0 : 0 28 28
2 : 12 : 0 29 29
2 : 24 : 0 30 30
2 : 36 : 0 31 31
2 : 48 : 0 32 32
3 : 0 : 0 33 33
3 : 12 : 0 34 34
3 : 24 : 0 35 35
3 : 36 : 0 36 36
3 : 48 : 0 37 37
4 : 0 : 0 38 38
4 : 12 : 0 39 39
4 : 24 : 0 40 40
4 : 36 : 0 41 41
4 : 48 : 0 42 42
5 : 0 : 0 43 43
5 : 12 : 0 44 44
5 : 24 : 0 45 45
5 : 36 : 0 46 46
5 : 48 : 0 47 47
6 : 0 : 0 48 48
6 : 12 : 0 49 49
6 : 24 : 0 50 50
6 : 36 : 0 51 51
6 : 48 : 0 52 52
7 : 0 : 0 53 53
7 : 12 : 0 54 54
7 : 24 : 0 55 55
7 : 36 : 0 56 56
7 : 48 : 0 57 57
8 : 0 : 0 58 58
8 : 12 : 0 59 59
8 : 24 : 0 60 60
|
Posted by Charlie
on 2005-06-19 15:36:59 |