楼主: 〇〇

[每日一题] puzzleup 2020 11月开始

[复制链接]
论坛徽章:
24
2010年世界杯参赛球队:韩国
日期:2009-12-20 20:11:33天枰座
日期:2015-07-18 17:23:54托尼托尼·乔巴
日期:2017-01-25 09:38:19秀才
日期:2017-03-02 10:30:14秀才
日期:2017-03-02 10:30:35秀才
日期:2017-06-29 10:16:48技术图书徽章
日期:2017-07-11 09:10:26乌索普
日期:2023-01-05 23:01:5220周年集字徽章-年	
日期:2021-05-27 09:37:50蒙奇·D·路飞
日期:2022-10-27 21:49:38
71#
发表于 2020-12-13 16:34 | 只看该作者
105个,1256种.

使用道具 举报

回复
论坛徽章:
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
72#
发表于 2020-12-13 21:09 | 只看该作者

我答案和你一样,你的代码是怎么写的?
等有空来验证一下猫猫的写法。

使用道具 举报

回复
论坛徽章:
548
生肖徽章2007版:猴
日期:2008-05-16 11:28:59生肖徽章2007版:马
日期:2008-10-08 17:01:01SQL大赛参与纪念
日期:2011-04-13 12:08:17授权会员
日期:2011-06-17 16:14:53ITPUB元老
日期:2011-06-21 11:47:01ITPUB官方微博粉丝徽章
日期:2011-07-01 09:45:27ITPUB十周年纪念徽章
日期:2011-09-27 16:30:472012新春纪念徽章
日期:2012-01-04 11:51:222012新春纪念徽章
日期:2020-11-30 22:13:24海蓝宝石
日期:2012-02-20 19:24:27
73#
发表于 2020-12-13 21:19 | 只看该作者
修改了 67 楼,规定了一下向量的方向,当考察正方形的某个顶点时,以这个顶点为中心,方向指向其它顶点和被考察的外面的点

SQL>
SQL>  with t as (select level n from dual connect by level <= 6),
  2        p as (select row_number() over(order by t1.n,t2.n) rn,t1.n x,t2.n y from t t1,t t2),
  3        s as (
  4  select p1.x x1,p1.y y1,
  5         p2.x x2,p2.y y2,
  6         p3.x x3,p3.y y3,
  7         p4.x x4,p4.y y4
  8    from p p1,p p2,p p3,p p4
  9   where p1.rn < p2.rn
10     and p2.rn < p3.rn
11     and p3.rn < p4.rn
12     and (p2.x-p1.x)*(p3.x-p1.x)+(p2.y-p1.y)*(p3.y-p1.y) = 0
13     and (p2.x-p1.x)*(p4.x-p2.x)+(p2.y-p1.y)*(p4.y-p2.y) = 0 and (p3.x-p1.x)*(p4.x-p3.x)+(p3.y-p1.y)*(p4.y-p3.y) = 0
14     and power((p2.x-p1.x),2)+power((p2.y-p1.y),2) = power((p3.x-p1.x),2)+power((p3.y-p1.y),2)
15  )
16  select
17         /*s1.x1 x1,s1.y1 y1,
18         s1.x2 x2,s1.y2 y2,
19         s1.x3 x3,s1.y3 y3,
20         s1.x4 x4,s1.y4 y4,
21         s2.x1 x5,s2.y1 y5,
22         s2.x2 x6,s2.y2 y6,
23         s2.x3 x7,s2.y3 y7,
24         s2.x4 x8,s2.y4 y8 */
25         count(*)
26    from s s1,s s2
27   where ( (s2.x1-s1.x1)*(s1.x3-s1.x1)+(s2.y1-s1.y1)*(s1.y3-s1.y1) < 0
28        or (s2.x1-s1.x1)*(s1.x2-s1.x1)+(s2.y1-s1.y1)*(s1.y2-s1.y1) < 0
29        or (s2.x1-s1.x2)*(s1.x4-s1.x2)+(s2.y1-s1.y2)*(s1.y4-s1.y2) < 0
30        or (s2.x1-s1.x2)*(s1.x1-s1.x2)+(s2.y1-s1.y2)*(s1.y1-s1.y2) < 0
31        or (s2.x1-s1.x3)*(s1.x1-s1.x3)+(s2.y1-s1.y3)*(s1.y1-s1.y3) < 0
32        or (s2.x1-s1.x3)*(s1.x4-s1.x3)+(s2.y1-s1.y3)*(s1.y4-s1.y3) < 0
33        or (s2.x1-s1.x4)*(s1.x2-s1.x4)+(s2.y1-s1.y4)*(s1.y2-s1.y4) < 0
34        or (s2.x1-s1.x4)*(s1.x3-s1.x4)+(s2.y1-s1.y4)*(s1.y3-s1.y4) < 0 )
35    and  ( (s2.x2-s1.x1)*(s1.x3-s1.x1)+(s2.y2-s1.y1)*(s1.y3-s1.y1) < 0
36        or (s2.x2-s1.x1)*(s1.x2-s1.x1)+(s2.y2-s1.y1)*(s1.y2-s1.y1) < 0
37        or (s2.x2-s1.x2)*(s1.x4-s1.x2)+(s2.y2-s1.y2)*(s1.y4-s1.y2) < 0
38        or (s2.x2-s1.x2)*(s1.x1-s1.x2)+(s2.y2-s1.y2)*(s1.y1-s1.y2) < 0
39        or (s2.x2-s1.x3)*(s1.x1-s1.x3)+(s2.y2-s1.y3)*(s1.y1-s1.y3) < 0
40        or (s2.x2-s1.x3)*(s1.x4-s1.x3)+(s2.y2-s1.y3)*(s1.y4-s1.y3) < 0
41        or (s2.x2-s1.x4)*(s1.x2-s1.x4)+(s2.y2-s1.y4)*(s1.y2-s1.y4) < 0
42        or (s2.x2-s1.x4)*(s1.x3-s1.x4)+(s2.y2-s1.y4)*(s1.y3-s1.y4) < 0 )
43    and  ( (s2.x3-s1.x1)*(s1.x3-s1.x1)+(s2.y3-s1.y1)*(s1.y3-s1.y1) < 0
44        or (s2.x3-s1.x1)*(s1.x2-s1.x1)+(s2.y3-s1.y1)*(s1.y2-s1.y1) < 0
45        or (s2.x3-s1.x2)*(s1.x4-s1.x2)+(s2.y3-s1.y2)*(s1.y4-s1.y2) < 0
46        or (s2.x3-s1.x2)*(s1.x1-s1.x2)+(s2.y3-s1.y2)*(s1.y1-s1.y2) < 0
47        or (s2.x3-s1.x3)*(s1.x1-s1.x3)+(s2.y3-s1.y3)*(s1.y1-s1.y3) < 0
48        or (s2.x3-s1.x3)*(s1.x4-s1.x3)+(s2.y3-s1.y3)*(s1.y4-s1.y3) < 0
49        or (s2.x3-s1.x4)*(s1.x2-s1.x4)+(s2.y3-s1.y4)*(s1.y2-s1.y4) < 0
50        or (s2.x3-s1.x4)*(s1.x3-s1.x4)+(s2.y3-s1.y4)*(s1.y3-s1.y4) < 0 )
51    and  ( (s2.x4-s1.x1)*(s1.x3-s1.x1)+(s2.y4-s1.y1)*(s1.y3-s1.y1) < 0
52        or (s2.x4-s1.x1)*(s1.x2-s1.x1)+(s2.y4-s1.y1)*(s1.y2-s1.y1) < 0
53        or (s2.x4-s1.x2)*(s1.x4-s1.x2)+(s2.y4-s1.y2)*(s1.y4-s1.y2) < 0
54        or (s2.x4-s1.x2)*(s1.x1-s1.x2)+(s2.y4-s1.y2)*(s1.y1-s1.y2) < 0
55        or (s2.x4-s1.x3)*(s1.x1-s1.x3)+(s2.y4-s1.y3)*(s1.y1-s1.y3) < 0
56        or (s2.x4-s1.x3)*(s1.x4-s1.x3)+(s2.y4-s1.y3)*(s1.y4-s1.y3) < 0
57        or (s2.x4-s1.x4)*(s1.x2-s1.x4)+(s2.y4-s1.y4)*(s1.y2-s1.y4) < 0
58        or (s2.x4-s1.x4)*(s1.x3-s1.x4)+(s2.y4-s1.y4)*(s1.y3-s1.y4) < 0 )


  COUNT(*)
----------
      3565

使用道具 举报

回复
论坛徽章:
548
生肖徽章2007版:猴
日期:2008-05-16 11:28:59生肖徽章2007版:马
日期:2008-10-08 17:01:01SQL大赛参与纪念
日期:2011-04-13 12:08:17授权会员
日期:2011-06-17 16:14:53ITPUB元老
日期:2011-06-21 11:47:01ITPUB官方微博粉丝徽章
日期:2011-07-01 09:45:27ITPUB十周年纪念徽章
日期:2011-09-27 16:30:472012新春纪念徽章
日期:2012-01-04 11:51:222012新春纪念徽章
日期:2020-11-30 22:13:24海蓝宝石
日期:2012-02-20 19:24:27
74#
发表于 2020-12-13 22:25 | 只看该作者
p1.rn < p2.rn
10     and p2.rn < p3.rn
11     and p3.rn < p4.rn  

这个条件已经确定了顶点的位置,所以后面的条件要依据这个来改。。。。不能瞎定。。。

使用道具 举报

回复
论坛徽章:
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
75#
发表于 2020-12-13 23:13 来自手机 | 只看该作者
你用4x4 验证一下你的代码,应该有20种画法。

使用道具 举报

回复
论坛徽章:
0
76#
发表于 2020-12-14 13:10 来自手机 | 只看该作者
If there exist more directions other than 0 and 45 degrees for 6x6 grid it is hard to imagine  how many directions there could be for a relatively large grid NxN.  I would finger count those extreme squares pairing with those “normal” squares since 6x6 grid is small enough (lol).  As to using where clause to check each pair I would prefer using a function which take rid, cid, and length as inputs and returns flag value 0 or 1.  Basically it should be able to process the check like “logical calculation”.  As to the pairing of abnormal and abnormal (say 45 and 45 ), I realized the condition should be the same as that for the pair of normal and normal.  This is because if rotating the grid clockwise wise (but keep squares unmoved) then it becomes the pair of normal and normal except the length unit is different (but it has no impact on the sharing condition).  So for any pair of abnormal 1 and abnormal 2 it can be treated as a pair of normal and a modified abnormal.  Hopefully this transformation can speed up the validation process in part two.

使用道具 举报

回复
论坛徽章:
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
77#
发表于 2020-12-14 22:27 | 只看该作者
jihuyao 发表于 2020-12-14 13:10
If there exist more directions other than 0 and 45 degrees for 6x6 grid it is hard to imagine  how m ...

还finger count呢,你有几个手指头?你的function是要检查“一对”正方形的关系吧,那么看你的参数设计已经败了,你以为两个正方形永远都是同样角度的?还是再仔细看看56楼的图,里面两个正方形一个正的一个斜的。

使用道具 举报

回复
论坛徽章:
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
78#
发表于 2020-12-16 22:54 | 只看该作者
#7 COUNTERFEIT COINS

There are 16 coins, 3 of which are slightly heavier or lighter than the others. The counterfeit coins both have the same weight but it is not known whether they are heavier or lighter than the genuine ones.

Using a balance scale, what is the minimum number of weighings in order to determine whether the counterfeit coins are heavier or lighter?

Notes:

All the coins look identical.
The genuine coins have the same weight.
You can compare any number of coins on the balance scale.

又有不良信息,不让我发布中文译文。

使用道具 举报

回复
论坛徽章:
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
79#
发表于 2020-12-16 22:56 | 只看该作者
本帖最后由 newkid 于 2020-12-17 08:56 编辑

有16枚硬币,其中3枚比其他硬币略重或略轻。假 币 的重量都一样,但不知道比真币重还是轻。用天枰称,要确定假 币是重还是轻,最少要称多少次?

注意:
所有的硬币看起来都是一样的。
真币的重量是一样的。
你可以在天枰上比较任何数量的硬币。

-------这道题没有说要把三枚假 币找出来,只是想知道轻重

使用道具 举报

回复
论坛徽章:
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
80#
发表于 2020-12-16 23:01 | 只看该作者
"假 币"是特么的敏感词,但是中间加了个空格就可以了!

使用道具 举报

回复

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

本版积分规则 发表回复

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