一道有趣的难题
神vLinux飘飘的翻译:考虑 0,1,2,...,N (N+1个整数),N为奇数. 玩家有操作者和程序组成. 操作者先喊,然后在程序和操作者之间交替进行.所有整数都只能被喊一次. 操作者记录所有被喊过的数字,并且随即喊一个尚未被喊过的数字.现在问题是:设计一个程序,它会喊一个没有被喊过的整数.然而程序不允许去记录那些数被喊过.除非那个数正好被操作者喊出.
英文原文:
(A simple game) Consider 0, 1, 2, ..., N (N +1 integers), where N is odd. The players consist
of a dealer and a computer program. The dealer makes the first call, and the calls alternate between the dealer
and the program. No integer can be called more than once. The dealer keeps track of all the integers called,
and he randomly calls an integer not yet called. Now the problem is to design the program, so that it will also
call an integer not yet called. However, the program is not allowed to remember what have been called, except
for the one just called by the dealer.
不一定要你写出代码,有个思路就好。
难就难在,program得以任何方式存储那些被喊过的数字,那这个程序应该如何去“想”一个数,并且让“想”出的那个数尽量是没被提出过的....否则program就会输掉和dealer的比赛。当所有的数字被提出后,program一次错误都没犯下那就判是program赢~~!
大家想想,我觉得这几乎是不可能...这是香港大学的大二的一道普通的题目,还不是能附加分数的那种