假定从上到下,每行从左到右依次是
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 http://bbs.emath.ac.cn/images/common/back.gif
903?错了吧903%144≠0
你用SQL? 错了,没有考虑各不相同这个条件 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; 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. 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
/ 居然有用SQL解决的,:handshake 6*6*6*4=864 种
页:
1
[2]