Baidu Ball(y) = x

JohnsonElizeee JohnsonElizeee 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Baidu:
用天平(只能比较,不能称重)从一堆小球中找出其中唯一一个较轻的,
使用x次天平 最多可以从y个小球中找出较轻的那个,求y与x的关系式。

set Ball(y) = x, we could get the following relation:
Ball(1) = 0;
Ball(2) = 1;
Ball(3) = 1;
Ball(4) = 2;
Ball(5) = 2;
Ball(6) = 2;
Ball(7) = 2;
Ball(8) = 2;
Ball(9) = 2;
Ball(10) = 3;
....
Ball(14) = 3;

set j is the second-max factor of y, as for number 28,
all the factors are 1, 2, 4, 7, 14, 28. so, j = 14.
set i is times number for i*j = y,
I get a relation between y and x: Ball(y) = (i/2) + Ball(j);

if y is a prime number, as 17, and its factors are 1 and itself, 17.
Ball(y) = Ball(y-1);

conclusion:

set j is the second-max factor of y and i*j = y;
if(j == 1) j = y-1; /* y is a prime number */
Ball(y) = (i/2) + Ball(j)

This opinion is out of full validation and test.
is it right?
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部