“Mangers and Engineers”
来源:互联网 发布:mac在哪里下游戏 编辑:程序博客网 时间:2024/06/16 00:41
Q:The FBI has surrounded the headquarters of the Norne corporation. There are n people in the building. Each person is either an engineer or a manager. All computer files have been deleted, and all documents have been shredded by the managers. The problem confronting the FBI interrogation team is to separate the people into these two classes, so that all the managers can be locked up and all the engineers can be freed. Each of then people knows the status of all the others. The interrogation consists entirely of asking personi if personj is an engineer or a manager. The engineers always tell the truth. What makes it hard is that the managers may not tell the truth. In fact, the managers are evil geniuses who are conspiring to confuse the interrogators.
- Under the assumption that more than half of the people are engineers, can you find a strategy for the FBI to find one engineer with at mostn-1 questions?
- Is this possible in any number of questions if half the people are managers?
- Once an engineer is found, he/she can classify everybody else. Is there a way to classify everybody in fewer questions?
A:
1.如果manager人数少于engineer人数:
initialize:将所有人放进UNSEEN集合中,从UNSEEN集合中随机选一人,放在STACK堆栈的top;
step1:从UNSEEN集合中随机选一个人x,向当前STACK堆栈的top元素y询问x的身份。如果y说x是manager,同时丢掉x和y,如果是engineer,将x放到STACK的top;
step2:repeat step1,直到UNSEEN集合为空,此时STACK的top元素的身份必然为engineer;
step3:向该engineer询问所有人的身份(因为他不撒谎),Ends。
n-1步就可以完成(特定情况下可以优化成n-2,n-3,不详述,参照Ref.)
but,如何proof???
2.如果manager人数多于或等于engineer人数,问题无解。
3. don't konw.
(Ref:The Puzzle Toad - 1)
- “Mangers and Engineers”
- C Programming for Scientists and Engineers
- WWDC-Watch and learn from our Engineers
- What happens to software engineers who don't climb the corporate ladder and stay as engineers?
- Essential MATLAB for Engineers and Scientists, Third Edition
- CUDA Fortran for Scientists and Engineers第二版翻译
- Google engineers
- ROI of Software Process Improvement: Metrics for Project Managers and Software Engineers
- Series 60 Smartphone Quality Assurance: A Guide for Mobile Engineers and Developers
- Introduction to MATLAB for Engineers and Scientists.pdf 2017 英文原版 免费下载
- Data Science with Java Practical Methods for Scientists and Engineers.pdf 英文原版 免费下载
- William J. Thompson, «Computing for Scientists and Engineers: A Workbook of Analysis, Numerics, and Applications»
- Looking for Senior QA Engineers/QA Automation Engineers
- Data Scientists vs. Data Engineers
- sound engineers or music lovers
- WinDbg basics HOWTO for QA engineers
- Interview Questions for Software Testing Engineers
- Interview Questions for Software Testing Engineers
- 记录锁详解
- ubuntu 10.04 开启root用户
- 和线程有关的函数结构
- 9 月份最受欢迎的 12 个 jQuery 插件
- 大数相乘的源码
- “Mangers and Engineers”
- 2012-10-23 11gR2 "ADMINISTRATOR'S GUIDE" page 62 - 110
- 如何连接myeclipse和access
- Editing a variable-length list, Knockout-style
- 关心关注自己所处的环境
- 32位机和64位机编程时应该注意些什么
- 链表奇偶位置调换
- C/C++解答集锦
- 【Linux读书笔记】初学Linux上手技巧