1.7 KiB
1.7 KiB
id | challengeType | title | videoUrl | localeTitle |
---|---|---|---|---|
5900f4ba1000cf542c50ffcd | 5 | Problem 334: Spilling the beans | 问题334:溢出豆子 |
Description
例如,考虑两个相邻的碗分别包含2个和3个豆,所有其他碗都是空的。以下八个动作将完成游戏:
您将获得以下序列:t0 = 123456。
ti = ti-12 , if ti-1 is even ti-12 926252, if ti-1 is odd where ⌊x⌋ is the floor function and is the bitwise XOR operator. bi = ( ti mod 211) + 1.
最后一个序列的前两个项是b1 = 289和b2 = 145.如果我们从两个相邻碗中的b1和b2豆开始,则需要3419100次移动来完成游戏。
现在考虑1500个相邻的碗,分别包含b1,b2,...,b1500豆,所有其他碗都是空的。查看游戏结束前需要多少动作。
Instructions
Tests
tests:
- text: <code>euler334()</code>应该返回150320021261690850。
testString: 'assert.strictEqual(euler334(), 150320021261690850, "<code>euler334()</code> should return 150320021261690850.");'
Challenge Seed
function euler334() {
// Good luck!
return true;
}
euler334();
Solution
// solution required