楼主: newkid

[每日一题] puzzleup 2021

[复制链接]
论坛徽章:
0
331#
发表于 2021-11-7 01:10 来自手机 | 只看该作者
Let me go further a little bit.  If 2b are in the group of 4.  Game is basically over.  If not, it may either contains 0 or 1.  Let us then take 0 case first.  Put group of 8 into 4/4 and compare one by one.  If both are even all in group of 8 are b and then compare it with 8/8 in group of 16 and so on.  If one of the 4/4 splits in group of 8 is uneven compared to the known 4a, it may contain 1 b or 2 b.  Go back to the very beginning if it is 2 b. Go back to the case of 3a+1b of group of 4 if a split in group of 8 is 3a+1b.  So basically it is like recursive function call all the way up to the last group of 32.

使用道具 举报

回复
论坛徽章:
520
奥运会纪念徽章:垒球
日期:2008-09-15 01:28:12生肖徽章2007版:鸡
日期:2008-11-17 23:40:58生肖徽章2007版:马
日期:2008-11-18 05:09:48数据库板块每日发贴之星
日期:2008-11-29 01:01:02数据库板块每日发贴之星
日期:2008-12-05 01:01:03生肖徽章2007版:虎
日期:2008-12-10 07:47:462009新春纪念徽章
日期:2009-01-04 14:52:28数据库板块每日发贴之星
日期:2009-02-08 01:01:03生肖徽章2007版:蛇
日期:2009-03-09 22:18:532009日食纪念
日期:2009-07-22 09:30:00
332#
 楼主| 发表于 2021-11-7 08:53 来自手机 | 只看该作者
你上面讲的例子,当左右平衡时无法区分是两边全为真,或者两边各一假。当不平衡时,你从别组取来的两个也毫无意义,再下一步的比较结果并不能给你新的信息。

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
333#
发表于 2021-11-7 10:44 来自手机 | 只看该作者
第10题因为第一投在循环外,所以累计次数初始值要为1

使用道具 举报

回复
论坛徽章:
0
334#
发表于 2021-11-7 23:20 来自手机 | 只看该作者
If 2 b in group of 4 and split 2/2 both are 1a+1b, then further split 1/1 must be true with 1a<>1b and and any pick from other groups must be true, either 1a=1a(from other group) or 1b<>1a(from other group).  So it is done as long as group of 4 contains 2 b.  For group of 4 with 0 b or 1 b will depends on recursive function call.  But execution order is critical and need well designed.

使用道具 举报

回复
论坛徽章:
0
335#
发表于 2021-11-8 00:33 来自手机 | 只看该作者
solomon_007 发表于 2021-11-5 21:51
# 10 模拟SQL> with function f_dart  2  return int  3  is  4    5    type t_seg is table of int index ...

Nice to see the function returning associative array.  There is optimization post recently which may apply such function to serve as index on fly.  Maybe I can borrow it to create a test case and see how Oracle optimizer responds to it.

使用道具 举报

回复
论坛徽章:
520
奥运会纪念徽章:垒球
日期:2008-09-15 01:28:12生肖徽章2007版:鸡
日期:2008-11-17 23:40:58生肖徽章2007版:马
日期:2008-11-18 05:09:48数据库板块每日发贴之星
日期:2008-11-29 01:01:02数据库板块每日发贴之星
日期:2008-12-05 01:01:03生肖徽章2007版:虎
日期:2008-12-10 07:47:462009新春纪念徽章
日期:2009-01-04 14:52:28数据库板块每日发贴之星
日期:2009-02-08 01:01:03生肖徽章2007版:蛇
日期:2009-03-09 22:18:532009日食纪念
日期:2009-07-22 09:30:00
336#
 楼主| 发表于 2021-11-10 09:52 | 只看该作者
jihuyao 发表于 2021-11-7 23:20
If 2 b in group of 4 and split 2/2 both are 1a+1b, then further split 1/1 must be true with 1a1b and ...

看不懂你的推理。你还是列出所有比较结果,并且对结果给出解释,然后说根据这个结果下一步要比较什么。
2 vs 2比较结果:
平衡(可能是2a vs 2a 也可能  a+b vs a+b)
不平衡(可能是 2a vs 2b 也可能是 a+b vs 2a, 至于b比a轻还是重,此时不知道)
从上面来看,下一步分别要怎么走?
别忘了此时4个里面可能含有0,1,2个b。你不能假设2b在4个那组,一切都是未知的。

使用道具 举报

回复
论坛徽章:
0
337#
发表于 2021-11-14 01:13 来自手机 | 只看该作者
Focus on 2/2 even case which could be 4a or 2a+2b(1a+1b on both sides).  Split one side only which is either 1a=1a or 1a<>1b.  If 1a=1a then group of 4 has 4 a and continue to compare split 4/4 of group 8 (skip for now).  If 1a<>1b then group of 4 has 2a+2b.  So all other groups only have a from which picking one and compare either side of split 1/1 and if equal then it is a otherwise it is b.  Do the same for the second 1/1 split to identify which one is b.  Done for group of 4 containing 2a+2b and split 2/2 even.  Now if split 2/2 of group 4 is uneven it implies the group of 4 has 1 b or 2 b (both b on one side).  Still focus on 2 b uneven case which implies split 1/1 of both sides must be true with 1a=1a and 1b=1b (for group of 4 having only 1 b it is 1a<>1b and 1a=1a).  Now picking any 2 from other groups which must 2 a and compare either side of 2/2 (uneven but both 1/1 splits are even).  If even that side has 2 a and if not that side has 2 b.  Done for the group of 4 in uneven case with 2 b on same side of split 2/2.  As said above group of 4 with 0 or 1 b are also identified but need further process to complete (skip for now to avoid confusion with cases of 2 b in group of 4.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表