2014-05-11 23:57

题目链接

原题:

 identical balls. one ball is heavy. find the heavy ball with only  measurements ........ dead easy.

题目:9个看起来一样的球,其中有一个偏重。给定一个不能给出具体重量,但可以比较轻重的天平,称2次找出那个重球。

解法:9个球三等分,称一次找出包含重球的那三个。3个球三等分,称一次找出重球。

代码:

 // http://www.careercup.com/question?id=5204967652589568
Answer:
Split the balls into three groups of balls.
Choose two groups and weigh them on the balance:
If balanced, the heavy ball is in the other group.
If imbalanced, the heavy ball is in the heavier group.
Find the group with the heavy ball, pick two balls from the three and weigh them:
If balanced, the heavy ball is the other one.
If imbalanced, the heavy ball is the heavier one.

Careercup - Microsoft面试题 - 5204967652589568的更多相关文章

  1. Careercup - Microsoft面试题 - 6314866323226624

    2014-05-11 05:29 题目链接 原题: Design remote controller for me. 题目:设计一个遥控器. 解法:遥控什么?什么遥控?传统的红外线信号吗?我只能随便说 ...

  2. Careercup - Microsoft面试题 - 6366101810184192

    2014-05-10 22:30 题目链接 原题: Design database locks to allow r/w concurrency and data consistency. 题目:设计 ...

  3. Careercup - Microsoft面试题 - 24308662

    2014-05-12 07:31 题目链接 原题: I have heard this question many times in microsoft interviews. Given two a ...

  4. Careercup - Microsoft面试题 - 5700293077499904

    2014-05-12 00:02 题目链接 原题: For a given map (ie Bing map) given longitude/latitude/ how would you desi ...

  5. Careercup - Microsoft面试题 - 5175246478901248

    2014-05-11 23:52 题目链接 原题: design an alarm clock for a deaf person. 题目:为聋人设计闹钟? 解法:聋人听不见,那么闪光.震动都可行.睡 ...

  6. Careercup - Microsoft面试题 - 5718181884723200

    2014-05-11 05:55 题目链接 原题: difference between thread and process. 题目:请描述进程和线程的区别. 解法:操作系统理论题.标准答案在恐龙书 ...

  7. Careercup - Microsoft面试题 - 5173689888800768

    2014-05-11 05:21 题目链接 原题: Complexity of a function: int func_fibonacci ( int n) { ) { return n; } el ...

  8. Careercup - Microsoft面试题 - 6282862240202752

    2014-05-11 03:56 题目链接 原题: Given an integer array. Perform circular right shift by n. Give the best s ...

  9. Careercup - Microsoft面试题 - 5428361417457664

    2014-05-11 03:37 题目链接 原题: You have three jars filled with candies. One jar is filled with banana can ...

随机推荐

  1. CentOS安装rpm包时error:Failed dependencies

    CentOS6.5安装rpm包时报错,error:Failed dependencies,解决方法如下: 在安装命令后加两个参数 --nodeps --force ,即安装时不再分析包之间的依赖关系而 ...

  2. java编程的78条黄金法则

    创建和销毁对象 1.考虑用静态工厂方法(返回类的实例的静态方法)代替构造器2.遇到多个构造器参数时要考虑用构造器3.用私有构造器或者枚举类型强化Singleton属性4.通过私有构造器强化不可实例化的 ...

  3. .NET 中的DateTime

    DateTime简介 DateTime是.NET中的时间类型,可以通过DateTime完成诸如获取当前的系统时间等操作.DateTime在.NET中是一个结构体,而并不是一个类. 如上图所示,这个图标 ...

  4. POJ C程序设计进阶 编程题#4:寻找平面上的极大点

    编程题#4:寻找平面上的极大点 来源: POJ (Coursera声明:在POJ上完成的习题将不会计入Coursera的最后成绩.) 注意: 总时间限制: 1000ms 内存限制: 65536kB 描 ...

  5. Overview Of Portal Registry And Content References

     Portal Registry Each portal is defined by a portal registry.A portal registry has a tree-like struc ...

  6. sublime几个有用的快捷键

    几个有用的快捷键:Ctrl+D:选择多个相同字符串进行修改.选中字符串,按住Ctrl+D,继续选中下一个.Ctrl+Shift+L:将选中的内容切割成多行,然后每一行可以同时编辑Ctrl+J:将已选择 ...

  7. mariadb的explain分析及InnoDB存储引擎

    id: 当前查询语句中,每个SELECT语句的编号,     id: 1  表示简单类型的查询 复杂类型的查询有三种:简单子查询,用于FROM中的子查询,联合查询:UNION 注意:UNION查询的分 ...

  8. xmpp push篇一 广播消息

    ---广播给所有人--- 1. 登录xmpp admin 账户 2. sendpacket <message to="pandans.com(域名)" > <bo ...

  9. android AES 部分机器javax.crypto.BadPaddingException: pad block corrupted

    package com.bbguoxue.poetry.util; import java.security.SecureRandom; import javax.crypto.Cipher; imp ...

  10. PHP搜索MYSQL数据库加分页浏览小结

    PHP搜索加分页浏览小结: 1 分页后再做搜索 2 这里对于url的拼接,以及模糊查询,搜索时候的显示添加,SQL语句的拼接 3 对于页面传递过来的超级链接的变量,如果不存在就要设置,对于可能抛出异常 ...