当年的算法题, 谁都不许查网, 看今晚能解出来不

来源: 古道阳关 2021-01-18 19:52:41 [] [博客] [旧帖] [给我悄悄话] 本文已被阅读: 次 (210 bytes)

12只球, 形状大小颜色都一样。其中一只和另外11只重量不一样。

只有一台天平, 只让称3次, 找到那个轻重和其它11个球不一样的球。。。

所有跟帖: 

我真的没查网, 像毛主席保证 -眼镜- 给 眼镜 发送悄悄话 (76 bytes) () 01/18/2021 postreply 19:57:18

细节还很多情况啊 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 19:58:56

第一次称天平倾斜比较麻烦 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:00:47

这种情况也可以 -眼镜- 给 眼镜 发送悄悄话 (117 bytes) () 01/18/2021 postreply 20:14:50

我只想明白了第一次称天平平衡是可以出来的 -眼镜- 给 眼镜 发送悄悄话 (60 bytes) () 01/18/2021 postreply 20:05:32

分成三组,挑出有问题的那个所在组就已经用了两次了,之后两个两个和没问题的任两个称又用了两次,我称六次 -终于不潜水了- 给 终于不潜水了 发送悄悄话 (177 bytes) () 01/18/2021 postreply 20:04:12

你跟我一样没看清是天平 -宗阕- 给 宗阕 发送悄悄话 宗阕 的博客首页 (0 bytes) () 01/18/2021 postreply 20:07:26

我知道是天平 -终于不潜水了- 给 终于不潜水了 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:10:13

估计还是笨办法。 -静听秋雨- 给 静听秋雨 发送悄悄话 静听秋雨 的博客首页 (224 bytes) () 01/18/2021 postreply 19:58:46

天平,只用了3次。不是称。 -静听秋雨- 给 静听秋雨 发送悄悄话 静听秋雨 的博客首页 (98 bytes) () 01/18/2021 postreply 20:01:42

天平啊lol -宗阕- 给 宗阕 发送悄悄话 宗阕 的博客首页 (0 bytes) () 01/18/2021 postreply 20:03:59

是421 么 -孵蛋妈- 给 孵蛋妈 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:07:40

要尽量称多才能有效利用三次天平 4-4 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:09:40

我的意思是抓4 个 和4 个 -孵蛋妈- 给 孵蛋妈 发送悄悄话 (312 bytes) () 01/18/2021 postreply 20:15:29

4和4不平的话,一次,和另外4再称,两次才找出含问题的4个 -终于不潜水了- 给 终于不潜水了 发送悄悄话 (204 bytes) () 01/18/2021 postreply 20:26:10

应该是442? -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:15:52

不用,第一次4个就可以称出了,然后就2-1 -宗阕- 给 宗阕 发送悄悄话 宗阕 的博客首页 (0 bytes) () 01/18/2021 postreply 20:17:38

我的421就是这个意思 -孵蛋妈- 给 孵蛋妈 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:19:23

没那么简单吧 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:21:54

这个10几年前俺考别人的LOL -skyport- 给 skyport 发送悄悄话 skyport 的博客首页 (0 bytes) () 01/18/2021 postreply 20:10:10

那你看着摊吧, 俺俩眼皮直打假, 呼呼去了。。。 -古道阳关- 给 古道阳关 发送悄悄话 古道阳关 的博客首页 (0 bytes) () 01/18/2021 postreply 20:17:06

出这题让人辗转反侧, 夜不能寐 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:24:32

这是初中的题目。有些小学生也能做出来。 -评论2012- 给 评论2012 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:21:00

我们在预防Alzheimer's disease。 -静听秋雨- 给 静听秋雨 发送悄悄话 静听秋雨 的博客首页 (177 bytes) () 01/18/2021 postreply 20:23:26

421或442 -lookforward- 给 lookforward 发送悄悄话 lookforward 的博客首页 (0 bytes) () 01/18/2021 postreply 20:25:34

关键是不知道有毛病的是轻还是重, 有时要混称 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:29:25

这题最早出现在1981年,当时算是非常难的,现在就小儿科了 -缘去缘来- 给 缘去缘来 发送悄悄话 缘去缘来 的博客首页 (0 bytes) () 01/18/2021 postreply 20:35:10

真的没听说过 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:36:04

当年俺在大学的时候同学们互相传的 -缘去缘来- 给 缘去缘来 发送悄悄话 缘去缘来 的博客首页 (0 bytes) () 01/18/2021 postreply 20:39:15

你们大学牛啊。 我们大学从来不整这高大上的东西 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:41:26

同学之间,那时候没啥娱乐的,就是整个急转弯,猜谜啥的 -缘去缘来- 给 缘去缘来 发送悄悄话 缘去缘来 的博客首页 (0 bytes) () 01/18/2021 postreply 20:47:15

我脚着俺们同学之间忌讳比脑子。上课,考试已经够被虐了 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:49:08

当年出去实习,坐火车都是硬座,住通间,大家凑钱买一本谜语书,晚上睡觉前解个10来道 -缘去缘来- 给 缘去缘来 发送悄悄话 缘去缘来 的博客首页 (0 bytes) () 01/18/2021 postreply 20:54:15

这是侃大山的好机会啊, 尤其周围有女生就更来神了。 你们很纯啊 :) -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:56:09

我们当时十个人有一张卧铺票,都让给女生了^_^ -缘去缘来- 给 缘去缘来 发送悄悄话 缘去缘来 的博客首页 (0 bytes) () 01/18/2021 postreply 20:59:30

不是80年就是81年,我做过。 -天用莫如龙- 给 天用莫如龙 发送悄悄话 天用莫如龙 的博客首页 (0 bytes) () 01/18/2021 postreply 21:45:47

interview被问过的题, -flagsix- 给 flagsix 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:39:06

这个我小时候 -古代的事物- 给 古代的事物 发送悄悄话 (107 bytes) () 01/18/2021 postreply 20:51:28

厉害啊 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:53:20

当然 -古代的事物- 给 古代的事物 发送悄悄话 (301 bytes) () 01/18/2021 postreply 20:55:59

没你什么事啊 -眼镜- 给 眼镜 发送悄悄话 (0 bytes) () 01/18/2021 postreply 20:57:34

好像不能算是小时候吧^_^ -缘去缘来- 给 缘去缘来 发送悄悄话 缘去缘来 的博客首页 (0 bytes) () 01/18/2021 postreply 21:02:09

天平可以对比两组,算一次,称三次就是对比了六组。要是普通称就歇菜了 -Zinfandel- 给 Zinfandel 发送悄悄话 Zinfandel 的博客首页 (343 bytes) () 01/18/2021 postreply 20:54:39

小学四年级的时候做过,特别有记忆力,前一种很容易,后一种情况最后一步不知道该怎么办,后来明白了。。 -天用莫如龙- 给 天用莫如龙 发送悄悄话 天用莫如龙 的博客首页 (0 bytes) () 01/18/2021 postreply 21:44:22

分三组a,b,c每组4个,第一次称a,b两组 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:24:00

1. 如果平衡,从c组拿两个和a组两个来称 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:25:00

1a. 如果平衡,从c组剩下的两个中取一个和其它称过的任意一个称 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:26:00

如果平衡,C组剩下那个有问题,但不知道是轻了还是重了 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:27:00

如果不平衡,c组那个如果轻就是它轻了,如果它重就是它重了 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:29:00

如果c组重了,把c组这两个拿来称一下,重的那个重了 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:32:00

如果c组的轻,把c组这两个拿来称一下,轻的那个轻了 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:30:00

2a. 如果平衡,从B组剩下三个拿两个来互称,如果平衡,B组剩下那个重了 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:45:00

2. 如果不平衡而且B组重,A组选三个B组选一个和C组称 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 04:44:00

95年面试碰到这个题,想清楚后画了个finite statemachine来解释,其实用流程图可能更合适,但我喜欢F'SM。我数 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 05:11:00

我数学很差但逻辑分析还行,所以接下来的问题:论证称n次最多能称出多少个球?我答不好。 -爪哇孤客- 给 爪哇孤客 发送悄悄话 (0 bytes) () 01/19/2021 postreply 05:11:00

请您先登陆,再发跟帖!