|
newkid 发表于 2014-9-3 23:40 ![]()
你这 a.n+b.n+c.n xyz是啥意思?
题目中的A,B,C,D,E都是体积。
不好意思,+改*就可以了
SQL> with t as (select rownum n from dual connect by level<300),
2 s as (
3 select a.n x,b.n y,c.n z, a.n*b.n*c.n xyz
4 from t a, t b,t c
5 where a.n <= b.n
6 and b.n <= c.n
7 and a.n > 1
8 and a.n*b.n*c.n = 2*(a.n-2)*(b.n-2)*(c.n-2)),
9 f as (
10 select sys_connect_by_path(xyz,',') xyz_list
11 from (select distinct xyz from s)
12 where level=5
13 connect by nocycle prior xyz < xyz)
14 select a
15 from (
16 select regexp_substr(xyz_list, '[^,]+', 1, 1) e,
17 regexp_substr(xyz_list, '[^,]+', 1, 2) d,
18 regexp_substr(xyz_list, '[^,]+', 1, 3) c,
19 regexp_substr(xyz_list, '[^,]+', 1, 4) b,
20 regexp_substr(xyz_list, '[^,]+', 1, 5) a
21 from f)
22 where (e+c=d+b and e+c=a) or (e+b=c+d and c+d=a)
23 /
A
--------------------------------------------------------------------------------
3024 |
|