找回密码
 欢迎注册
楼主: jmyhyu

[讨论] 填数字游戏

[复制链接]
发表于 2009-12-2 13:57:55 | 显示全部楼层
10楼并假定每个菱形小面数字小于下面
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2009-12-2 14:05:33 | 显示全部楼层
本帖最后由 jmyhyu 于 2009-12-2 14:08 编辑
假定从上到下,每行从左到右依次是
1 2 3
4 5 6 7
8 9 10

with t1 as(select level l from dual connect by level
〇〇 发表于 2009-12-2 13:55


903?错了吧  903%144≠0

你用SQL?
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-12-2 15:04:21 | 显示全部楼层
错了,没有考虑各不相同这个条件
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-12-2 15:21:54 | 显示全部楼层
with t as(select level l from dual connect by level<=10) /* x9=7-x2,x6=17-x5*/
select * from(
select
x1.l x1,
x2.l x2,
x3.l x3,
x4.l x4,
x5.l x5,
17-x5.l x6,
x7.l x7,
x8.l x8,
7-x2.l x9,
x10.l x10
from t x1,t x2,t x3,t x4,t x5,/*t x6,*/t x7,t x8,/*t x9,*/t x10
where x1.l+x4.l+x5.l+x8.l=24
and x2.l+x5.l+17-x5.l+x8.l=24
and x3.l+17-x5.l+x7.l+x10.l=24
and x1.l<x8.l --and x2.l<7-x2.l and x3.l<x10.l
)
where
(x1-x2)*(x1-x3)*(x1-x4)*(x1-x5)*(x1-x6)*(x1-x7)*(x1-x8)*(x1-x9)*(x1-x10)<>0 and
(x2-x1)*(x2-x3)*(x2-x4)*(x2-x5)*(x2-x6)*(x2-x7)*(x2-x8)*(x2-x9)*(x2-x10)<>0 and
(x3-x2)*(x3-x1)*(x3-x4)*(x3-x5)*(x3-x6)*(x3-x7)*(x3-x8)*(x3-x9)*(x3-x10)<>0 and
(x4-x2)*(x4-x3)*(x4-x1)*(x4-x5)*(x4-x6)*(x4-x7)*(x4-x8)*(x4-x9)*(x4-x10)<>0 and
(x5-x2)*(x5-x3)*(x5-x4)*(x5-x1)*(x5-x6)*(x5-x7)*(x5-x8)*(x5-x9)*(x5-x10)<>0 and
(x6-x2)*(x6-x3)*(x6-x4)*(x6-x5)*(x6-x1)*(x6-x7)*(x6-x8)*(x6-x9)*(x6-x10)<>0 and
(x7-x2)*(x7-x3)*(x7-x4)*(x7-x5)*(x7-x6)*(x7-x1)*(x7-x8)*(x7-x9)*(x7-x10)<>0 and
(x8-x2)*(x8-x3)*(x8-x4)*(x8-x5)*(x8-x6)*(x8-x7)*(x8-x1)*(x8-x9)*(x8-x10)<>0 and
(x9-x2)*(x9-x3)*(x9-x4)*(x9-x5)*(x9-x6)*(x9-x7)*(x9-x8)*(x9-x1)*(x9-x10)<>0 and
(x10-x2)*(x10-x3)*(x10-x4)*(x10-x5)*(x10-x6)*(x10-x7)*(x10-x8)*(x10-x9)*(x10-x1)<>0 and
rownum<=10;
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-12-2 16:43:47 | 显示全部楼层
with t as(select level l from dual connect by level<=10) /* x9=7-x2,x6=17-x5*/
select * from(
select
x1.l x1,
x2.l x2,
x3.l x3,
x4.l x4,
x5.l x5,
17-x5.l x6,
x7.l x7,
x8.l x8,
7-x2.l x9,
x10.l x10
from t x1,t x2,t x3,t x4,t x5,/*t x6,*/t x7,t x8,/*t x9,*/t x10
where x1.l+x4.l+x5.l+x8.l=24
and x2.l+x5.l+17-x5.l+7-x2.l=24
and x3.l+17-x5.l+x7.l+x10.l=24
and x1.l<x8.l and x2.l<7-x2.l and x3.l<x10.l and x4.l<x7.l
)
where
(x1-x2)*(x1-x3)*(x1-x4)*(x1-x5)*(x1-x6)*(x1-x7)*(x1-x8)*(x1-x9)*(x1-x10)<>0 and
(x2-x1)*(x2-x3)*(x2-x4)*(x2-x5)*(x2-x6)*(x2-x7)*(x2-x8)*(x2-x9)*(x2-x10)<>0 and
(x3-x2)*(x3-x1)*(x3-x4)*(x3-x5)*(x3-x6)*(x3-x7)*(x3-x8)*(x3-x9)*(x3-x10)<>0 and
(x4-x2)*(x4-x3)*(x4-x1)*(x4-x5)*(x4-x6)*(x4-x7)*(x4-x8)*(x4-x9)*(x4-x10)<>0 and
(x5-x2)*(x5-x3)*(x5-x4)*(x5-x1)*(x5-x6)*(x5-x7)*(x5-x8)*(x5-x9)*(x5-x10)<>0 and
(x6-x2)*(x6-x3)*(x6-x4)*(x6-x5)*(x6-x1)*(x6-x7)*(x6-x8)*(x6-x9)*(x6-x10)<>0 and
(x7-x2)*(x7-x3)*(x7-x4)*(x7-x5)*(x7-x6)*(x7-x1)*(x7-x8)*(x7-x9)*(x7-x10)<>0 and
(x8-x2)*(x8-x3)*(x8-x4)*(x8-x5)*(x8-x6)*(x8-x7)*(x8-x1)*(x8-x9)*(x8-x10)<>0 and
(x9-x2)*(x9-x3)*(x9-x4)*(x9-x5)*(x9-x6)*(x9-x7)*(x9-x8)*(x9-x1)*(x9-x10)<>0 and
(x10-x2)*(x10-x3)*(x10-x4)*(x10-x5)*(x10-x6)*(x10-x7)*(x10-x8)*(x10-x9)*(x10-x1)<>0
/
        X1         X2         X3         X4         X5         X6         X7         X8         X9        X10
---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
         5          1          2          4          7         10          9          8          6          3
         4          1          2          5          7         10          9          8          6          3
         4          1          2          8          7         10          9          5          6          3
         5          1          2          4          8          9         10          7          6          3
         4          1          2          5          8          9         10          7          6          3
         4          1          2          7          8          9         10          5          6          3
         6          2          1          3          7         10          9          8          5          4
         3          2          1          6          7         10          9          8          5          4
         3          2          1          8          7         10          9          6          5          4
         6          2          1          3          8          9         10          7          5          4
         3          2          1          6          8          9         10          7          5          4
         3          2          1          7          8          9         10          6          5          4
         5          1          2          3          7         10          8          9          6          4
         3          1          2          5          7         10          8          9          6          4
         5          1          2          3          9          8         10          7          6          4
         3          1          2          5          9          8         10          7          6          4
         3          1          2          7          9          8         10          5          6          4
         6          3          1          2          7         10          8          9          4          5
         2          3          1          6          7         10          8          9          4          5
         6          3          1          2          9          8         10          7          4          5
         2          3          1          6          9          8         10          7          4          5
         2          3          1          7          9          8         10          6          4          5
         4          1          3          2          8          9          7         10          6          5
         2          1          3          4          8          9          7         10          6          5
         4          1          3          2         10          7          9          8          6          5
         2          1          3          4         10          7          9          8          6          5
         2          1          3          8         10          7          9          4          6          5
         3          1          4          2          9          8          7         10          6          5
         2          1          4          3          9          8          7         10          6          5
         3          1          4          2         10          7          8          9          6          5
         2          1          4          3         10          7          8          9          6          5
         5          3          2          1          8          9          7         10          4          6
         1          3          2          5          8          9          7         10          4          6
         5          3          2          1         10          7          9          8          4          6
         1          3          2          5         10          7          9          8          4          6
         1          3          2          8         10          7          9          5          4          6
         4          2          3          1          9          8          7         10          5          6
         1          2          3          4          9          8          7         10          5          6
         4          2          3          1         10          7          8          9          5          6
         1          2          3          4         10          7          8          9          5          6
         5          3          2          1          8          9          6         10          4          7
         1          3          2          5          8          9          6         10          4          7
         4          1          3          2          8          9          5         10          6          7
         2          1          3          4          8          9          5         10          6          7
         4          2          3          1          9          8          6         10          5          7
         1          2          3          4          9          8          6         10          5          7
         3          1          4          2          9          8          5         10          6          7
         2          1          4          3          9          8          5         10          6          7
         4          1          5          2          8          9          3         10          6          7
         3          1          5          2          9          8          4         10          6          7
         2          1          5          3          9          8          4         10          6          7
         4          2          6          1          9          8          3         10          5          7
         5          3          6          1          8          9          2         10          4          7
         6          3          1          2          7         10          5          9          4          8
         5          1          2          3          7         10          4          9          6          8
         4          2          3          1         10          7          6          9          5          8
         1          2          3          4         10          7          6          9          5          8
         3          1          4          2         10          7          5          9          6          8
         2          1          4          3         10          7          5          9          6          8
         3          1          5          2         10          7          4          9          6          8
         2          1          5          3         10          7          4          9          6          8
         4          2          6          1         10          7          3          9          5          8
         6          2          1          3          7         10          4          8          5          9
         5          3          2          1         10          7          6          8          4          9
         1          3          2          5         10          7          6          8          4          9
         4          1          3          2         10          7          5          8          6          9
         2          1          3          4         10          7          5          8          6          9
         4          1          5          2         10          7          3          8          6          9
         5          3          6          1         10          7          2          8          4          9
         6          2          1          3          8          9          4          7          5         10
         6          3          1          2          9          8          5          7          4         10
         5          1          2          3          9          8          4          7          6         10

72 rows selected.
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-12-2 20:12:09 | 显示全部楼层
with t as(select level l from dual connect by level<=10) /* x9=7-x2,x6=17-x5*/
select * from(
select
x1.l x1,
x2.l x2,
x3.l x3,
x4.l x4,
x5.l x5,
17-x5.l x6,
x7.l x7,
x8.l x8,
7-x2.l x9,
x10.l x10
from t x1,(select l from t where l in(1,2,3))x2,t x3,t x4,
(select l from t where l in(7,8)) x5,/*t x6,*/t x7,t x8,/*t x9,*/t x10
where x1.l+x4.l+x5.l+x8.l=24
and x2.l+x5.l+17-x5.l+7-x2.l=24
and x3.l+17-x5.l+x7.l+x10.l=24
and x1.l<x8.l and x3.l<x10.l
)
where
(x1-x2)*(x1-x3)*(x1-x4)*(x1-x5)*(x1-x6)*(x1-x7)*(x1-x8)*(x1-x9)*(x1-x10)<>0 and
(x2-x3)*(x2-x4)*(x2-x5)*(x2-x6)*(x2-x7)*(x2-x8)*(x2-x9)*(x2-x10)<>0 and
(x3-x4)*(x3-x5)*(x3-x6)*(x3-x7)*(x3-x8)*(x3-x9)*(x3-x10)<>0 and
(x4-x5)*(x4-x6)*(x4-x7)*(x4-x8)*(x4-x9)*(x4-x10)<>0 and
(x5-x6)*(x5-x7)*(x5-x8)*(x5-x9)*(x5-x10)<>0 and
(x6-x7)*(x6-x8)*(x6-x9)*(x6-x10)<>0 and
(x7-x8)*(x7-x9)*(x7-x10)<>0 and
(x8-x9)*(x8-x10)<>0 and
(x9-x10)<>0
/

评分

参与人数 1鲜花 +2 收起 理由
winxos + 2 语言用的真好!

查看全部评分

毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-12-16 19:37:30 | 显示全部楼层
居然有用SQL解决的,
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2010-1-17 18:36:37 | 显示全部楼层
6*6*6*4=864 种
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-6-17 19:09 , Processed in 0.048287 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表