由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一题
相关主题
牛STARTUP为什么收回OFFER?k-selection algorithm
印度经理的主要问题问一个面试题,给两个数,求商和余数
说是上周五之前给信儿为啥没到这周一过了还没动静请教一个reverse decimal number的问题
再来一个brainteaseronsite后被拒,怎么回复对方邮件呢?
面试遇到常见题怎么处理?问个智力题
请教一道面试题(概率统计)IDT面试经历
急问一个题问个amazon面试题。
请教一个bloomberg题目经典activity selection的问题
相关话题的讨论汇总
话题: losing话题: player话题: winning话题: first话题: 59
进入JobHunting版参与讨论
1 (共1页)
l********r
发帖数: 11
1
Two people play a game. In turn, each player says a number between 1 and
10 (inclusive). The accumulative score is recorded. The aim of the game is
force your opponent to make the total equal to or above 60. As the player
going first, what strategy should you adopt to enable you to guarantee a
victory?
x***y
发帖数: 633
2
a variation of NIM. L: losing, W: winning
You only need to move your opponent to the losing position.
1 is losing
2-11 are winning
12 losing
13-22 winning
23 losing
24-33 winning
34 losing
35-44 winning
45 losing
46-55 winning
56 losing
57-60 winning
s*****t
发帖数: 737
3
I think you can think in a reverse way.
You are guaranteed to win, if you get chance to make the total number to 59
You are guaranteed to make the total number to 59, if you get chance to make
the second to last total number to 48, and so on, 37, 26, 15, 4.
So in order to win, you need to be the first guy to say 4.
correct me if I'm wrong

【在 l********r 的大作中提到】
: Two people play a game. In turn, each player says a number between 1 and
: 10 (inclusive). The accumulative score is recorded. The aim of the game is
: force your opponent to make the total equal to or above 60. As the player
: going first, what strategy should you adopt to enable you to guarantee a
: victory?

s*****t
发帖数: 737
4
I didn't get it. What is NIM? Why 56 is a losing position?

a variation of NIM. L: losing, W: winning
You only need to move your opponent to the losing position.
1 is losing
2-11 are winning
12 losing
13-22 winning
23 losing
24-33 winning
34 losing
35-44 winning
45 losing
46-55 winning
56 losing
57-60 winning

【在 x***y 的大作中提到】
: a variation of NIM. L: losing, W: winning
: You only need to move your opponent to the losing position.
: 1 is losing
: 2-11 are winning
: 12 losing
: 13-22 winning
: 23 losing
: 24-33 winning
: 34 losing
: 35-44 winning

B*****t
发帖数: 335
5
should go for 4 first

between 1 and
the game is
the player
guarantee a

【在 l********r 的大作中提到】
: Two people play a game. In turn, each player says a number between 1 and
: 10 (inclusive). The accumulative score is recorded. The aim of the game is
: force your opponent to make the total equal to or above 60. As the player
: going first, what strategy should you adopt to enable you to guarantee a
: victory?

c****w
发帖数: 565
6
哈哈,记得小时候老爸和我玩的游戏,指定一个数字为目标。我俩一人说一个数字,从
1开始,每个数字是上一个人的数字加上1-3之间的数,嘿嘿,竟然面试也有这种题目。
这题就是看谁先说到59,看错,包含10,一共11个数字,算算59除以11的余数吧,然后每次都要说到这个余数加11n,over.
i***1
发帖数: 95
7
if the player go first, and he play optimally, I will lose.
The secret is that whatever the number one player pick (say a), the other
player can pick a corresponding number (b = 11-a)
so the player who pick first should pick 4. After that, keep going like what
mentioned above, and will reach 59.
p*******o
发帖数: 6791
8

59
make
second this, this is exactly what i would do.

【在 s*****t 的大作中提到】
: I think you can think in a reverse way.
: You are guaranteed to win, if you get chance to make the total number to 59
: You are guaranteed to make the total number to 59, if you get chance to make
: the second to last total number to 48, and so on, 37, 26, 15, 4.
: So in order to win, you need to be the first guy to say 4.
: correct me if I'm wrong

x*****p
发帖数: 1707
9
The first player say 4 first, then no matter what the second play selects,
the first player always add it to 11.
Then the first player will add numbers to sum to following numbers.
4
15
26
37
48
59
Win!
x*****p
发帖数: 1707
10
The first player say 4 first, then no matter what the second play selects,
the first player always add it to 11.
Then the first player will add numbers to sum to following numbers.
4
15
26
37
48
59
Win!
1 (共1页)
进入JobHunting版参与讨论
相关主题
经典activity selection的问题面试遇到常见题怎么处理?
只用加减实现整数除法,到底想考查什么?请教一道面试题(概率统计)
新手问个初级问题, 面试coding的时候数字转字符串用itoa还是stringstream?急问一个题
请问给一个整数,如何返回他的平方根?请教一个bloomberg题目
牛STARTUP为什么收回OFFER?k-selection algorithm
印度经理的主要问题问一个面试题,给两个数,求商和余数
说是上周五之前给信儿为啥没到这周一过了还没动静请教一个reverse decimal number的问题
再来一个brainteaseronsite后被拒,怎么回复对方邮件呢?
相关话题的讨论汇总
话题: losing话题: player话题: winning话题: first话题: 59