|
|
#1
SQL> with t(n,x,y) as
2 (select 1,0,0 from dual
3 union all
4 select 2,1,0 from dual
5 union all
6 select 3,2,0 from dual
7 union all
8 select 4,1/2,sqrt(3)/2 from dual
9 union all
10 select 5,3/2,sqrt(3)/2 from dual
11 union all
12 select 6,1,sqrt(3) from dual
13 union all
14 select 7,0,sqrt(3) from dual
15 ),
16 s (n,x,y) as (
17 select rownum rn,x,y
18 from (
19 select distinct x,y
20 from (
21 select x,y from t
22 union all
23 select -x,y from t
24 union all
25 select -x,-y from t
26 union all
27 select x,-y from t
28 )
29 order by x,y
30 )
31 )
32 select count(*)
33 from (
34 select a.n n1,b.n n2,c.n n3,
35 round(sqrt(power(a.x-b.x,2)+power(a.y-b.y,2)),2) ab,
36 round(sqrt(power(a.x-c.x,2)+power(a.y-c.y,2)),2) ac,
37 round(sqrt(power(b.x-c.x,2)+power(b.y-c.y,2)),2) bc
38 from s a,s b,s c
39 where
40 a.n < b.n
41 and b.n < c.n
42 )
43 where ab=ac
44 and ac=bc
45 /
COUNT(*)
----------
66
|
|