微軟面試題

1.燒一根不均勻的繩,從頭燒到尾總共須要1 個小時。如今有若干條材質相同的繩子,問如何用燒繩的方法來計時一個小時十五分鐘呢? app

點燃兩根繩子,其中一個點燃兩頭,另一個點燃一頭.等兩頭的燃燒結束後,點燃剩下的那個繩子的另一頭,燃燒結束就是15分鐘. this

2.12 個球一個天平,現知道只有一個和其它的重量不一樣,問怎樣稱才能用三次就找到那個
球。13 個呢?(注意此題並未說明那個球的重量是輕是重,因此須要仔細考慮)(5 分鐘-1 小時)
ANSWER
Too complicated. Go find brain teaser answers by yourself. spa

3.在9 個點上畫10 條直線,要求每條直線上至少有三個點?(3 分鐘-20 分鐘) orm


4.在一天的24 小時之中,時鐘的時針、分針和秒針徹底重合在一塊兒的時候有幾回?都分別是什麼時間?你怎樣算出來的?(5 分鐘-15 分鐘) three


http://www.answers.com/Q/How_many_times_do_a_clock's_hands_overlap_in_a_day ip

22 times a day if you only count the minute and hour hands overlapping. The approximate times are listed below. (For the precise times, see the related question.) 

2 times a day if you only count when all three hands overlap. This occurs at midnight and noon. 

am 12:00 
1:05 
2:11 
3:16 
4:22 
5:27 
6:33 
7:38 
8:44 
9:49 
10:55 
 pm 12:00 
1:05 
2:11 
3:16 
4:22 
5:27 
6:33 
7:38 
8:44 
9:49 
10:55 

A really simple way to see this is to imagine that the two hands are racing each other around a track. Every time the minute hand 'laps' the hour hand, we have the overlaps we want. 

So, we can say that the number of laps completed by the minute hand every T hours, Lm = T laps. Since there are 12hours in a full rotation of the hour hand, that hand only rotates Lh = T/12 laps. 


In order for the first 'lapping' to occur, the minute hand must do one more lap than the hour hand: Lm = Lh +1, so we get T = T/12 + 1 and that tells us that the first overlap happens after T = (12/11) hours. Similarly, the 2nd lapping will occur when Lm = Lh + 2. 


In general, the 'Nth' lapping will occur when Lm = Lh +N, which means every N*(12/11) hours (for N = 0,1,2,3...). In other words, it will happen approximately every 1hr5mins27secs, starting at 00:00. In 24hours, this occurs a total of 24/(12/11) = 22 times. 












======================================================================================

So we are looking at two rotating hands. Ultimately, its just the angles we care about. Let θH represent the angle of the hours hand and θM represent the angle of the minutes hand. You could also introduce the seconds hand but that makes the problem more complicated. For now, lets assume the question only cares about the minute and hour hands. Initially we might think we are looking for: 

θH=θM 

But this doesn't take into account that if one hand has "gone around" a few times, its angle will be different from a hand in the same position that hasn't "gone around" the same number of times. So we have to modify our goal. Instead we let the angles differ by an integer multiple of 2π (360°). Let us call this arbitrary integer z. Now our condition is: 

θM-θH=2πz 

You could subtract the two angles in either order but the reason I chose to subtract hours from minutes is because it will result in positive integers which is just simpler. The minute hand goes around more times, thus its angle is bigger, thus this order of subtraction is positive. Now we have to find out how these angles depend upon the time. Let us call our time t and measure it in hours. I omit units for simplicity. The hour hand goes around a full rotation (2π) once every 12 hours. So: 

θH=(2π/12) t 

For those more versed in mathematics, 2π/12 is the "angular frequency" for the hour hand (usually denoted by ω). 

Similarly the minute hand goes around a full rotation (2π) once every hour. So: 

θM=2π t 

Plugging back in: 

θM-θH=2πz 
2π t - (2π/12) t = 2πz 
t - t/12 = z 
(11/12) t = z 

Now we are ready to solve. The two hands overlap at every solution of this equation, so we want to know the number of solutions of this equation. But remember, we want to know how many times this happens in a single day, so t cant be bigger than 24 (remember we are measuring t in hours), and technically no smaller than 0 (assuming we start our clock at 0 hours). Since t and z are proportional, each solution for z corresponds to exactly one solution for t, and accordingly exactly one solution of the equation. 

Also, remember than z must be an integer. So if we wanted all the times we would just let z go from 0 (when t=0) up and solve for t and stop as soon as we passed t=24. Then of course we'd have to convert that into hour and minute format. However, we only care about the number of times this happens. So we can notice that as t increases, z is just keeping track of how many times the two hands have overlapped. When z=0 we get the first time, when z=1 we get the second time, and so on. Since t and z are directly proportional, t increases with z, thus z represents the number of times the hands have overlapped up until time t minus 1 (and starting from t=0). Since we don't want t to go past 24, we plug in 24 and solve for z which will tell us how many times this event has occurred from t=0 to t=24 (one day). 

(11/12)*24 = z 
22 = z 

So this happens 22 times in a day. Technically this has 23 solutions (0 through 22) but the last one is for t=24 which has begun the next day. If we don't count that solution we are left with 22.■ 

If we want the second hand to overlap as well, we have to go a bit further. First we note that the second hand makes a full rotation once every minute, thus 60 times an hour. From this we have: 

θS=(2π*60) t 

We want the second and hour hands to overlap AND the minute and second hands to overlap. Those conditions can be summarized as follows, where x and y are positive integers: 

θS-θM=2πx 
θS-θH=2πy 

Plugging in our functions of t for the θ's and solving for t we are left with: 

t=x/59 
t=12y/719 

We want our integers x and y to produce the same time (making all hands overlap at that time). So we want to set the two equations equal. Simplifying, we get; 

x=708y/719 

708 and 719 are coprime (719 is prime and 708 is decomposed into 2^2*3*59). In fact 708y and 719 are coprime except for when y is an integer multiple of 719. Thus 708y/719 can only be reduced when y=719k for some integer k. In this case we have: 
x=708k 

The first solution is when k=0. Then x=0 and t=0 corresponding to midnight. The next solution is k=1. Then x=708 and t=12 corresponding to noon. The next solution is k=2 but this corresponds to t=24 which is (midnight for) the next day and due to the direct proportionality of t and k, every k from here on up will produce t's higher than 24. 

In summary, all three hands only overlap twice a day: at noon and midnight. ■ 




All of this assumes that the hands sweep continuously. So the math is more(?) complicated for those with fake Rolex's (or any ticking handed clocks). ci

相關文章
相關標籤/搜索