文档章节

微软面试题

pczhangtl
 pczhangtl
发布于 2014/09/02 10:11
字数 1467
阅读 12
收藏 0

1.烧一根不均匀的绳,从头烧到尾总共需要1 个小时。现在有若干条材质相同的绳子,问如何用烧绳的方法来计时一个小时十五分钟呢?

点燃两根绳子,其中一个点燃两头,另外一个点燃一头.等两头的燃烧结束后,点燃剩下的那个绳子的另外一头,燃烧结束就是15分钟.

2.12 个球一个天平,现知道只有一个和其它的重量不同,问怎样称才能用三次就找到那个
球。13 个呢?(注意此题并未说明那个球的重量是轻是重,所以需要仔细考虑)(5 分钟-1 小时)
ANSWER
Too complicated. Go find brain teaser answers by yourself.

3.在9 个点上画10 条直线,要求每条直线上至少有三个点?(3 分钟-20 分钟)


4.在一天的24 小时之中,时钟的时针、分针和秒针完全重合在一起的时候有几次?都分别是什么时间?你怎样算出来的?(5 分钟-15 分钟)


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

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).

本文转载自:http://blog.csdn.net/v_july_v/article/details/6870251

共有 人打赏支持
pczhangtl
粉丝 46
博文 707
码字总数 113318
作品 0
浦东
高级程序员
私信 提问
微软ASP.NET 电商网站开发实战 MVC6 +HTML5 +WCF+WebAPI+NoSQL+mongoDB+Redis+Core视频 代码 面试题

《微软ASP.NET 电商网站开发实战 MVC6 +HTML5 +WCF+WebAPI+NoSQL+mongoDB+Redis+Core 视频 代码 面试题 》下载网盘:https://yunpan.cn/cP7SNIjgJYYjA 访问密码 7fc6 微软特邀讲师 徐雷Frank...

frankxulei
2016/06/23
0
0
18届清华硕士狂拿18家互联网公司offer

2018校招总结(外企,国内大公司,国内创业公司) 本篇是我参加2018春招实习和秋招的求职经历,除了笔试面试中遇到的一些问题,更多的是一些个人想法。 春招和秋招面了不少公司,实习offer有...

野梦M
2017/12/18
0
1
微软面试、经典算法、编程艺术、红黑树4大系列总结

无私分享,造福天下 以下是本blog内的微软面试100题系列,经典算法研究系列,程序员编程艺术系列,红黑树系列4大经典原创系列作品与一些重要文章的集锦。 一、微软面试100题系列 横空出世,席...

长平狐
2013/01/06
299
0
微软SDE面经(电面+onsite)

本人工作1年多了,正在准备跳槽中。刚刚参加完微软西雅图的面试,来分享一下自己的面试过程。一共7轮面试,其中1轮电面,6轮Onsite。 第一轮 电面1 第一轮是电面,先是让自我介绍,然后根据简...

abcdd1234567890
2017/06/14
0
0
[转载]9个offer,12家公司,35场面试,从微软到谷歌,应届计算机毕业生的2012求职之路

1,简介 毕业答辩搞定,总算可以闲一段时间,把这段求职经历写出来,也作为之前三个半月的求职的回顾。 首先说说我拿到的offer情况: 微软,3面->终面,搞定 百度,3面->终面,口头offer 搜狗...

蟋蟀哥哥
2013/01/10
8.4K
50

没有更多内容

加载失败,请刷新页面

加载更多

欧拉公式

欧拉公式表达式 欧拉公式的几何意 cosθ + j sinθ 是个复数,实数部分也就是实部为 cosθ ,虚数部分也就是虚部为 j sinθ ,对应复平面单位圆上的一个点。 根据欧拉公式和这个点可以用 复指...

sharelocked
35分钟前
2
0
burpsuite无法抓取https数据包

1.将浏览器和burpsuite的代理都设置好 2.在浏览器地址栏输入: http://burp 3.下载下面的证书,并将证书导入浏览器 cacert.der

Frost729
59分钟前
1
0
JeeSite4.x 消息管理、消息推送、消息提醒

实现统一的消息推送接口,包含PC消息、短信消息、邮件消息、微信消息等,无需让所有开发者了解消息是怎么发送出去的,只需了解消息发送接口即可。 所有推送消息均通过 MsgPushUtils 工具类发...

ThinkGem
今天
6
0
OpenML

https://www.openml.org/search?type=data

shengjuntu
今天
2
0
java强引用,软引用,弱引用和虚引用

先来简要说一下这四种引用的特性: 强引用:如果一个对象具有强引用,那垃圾回收器绝不会回收它 软引用:如果一个对象只具有软引用,则内存空间足够,垃圾回收器就不会回收它 弱引用:在垃圾...

woshixin
今天
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部