|
凑了半天,终于出结果了,很难看,主要是应付6,9可以互换
with t as(select level-1 l from dual connect by level<=10),
t1(a,p,lv) as(select l,power(2,l),1 from t
union all
select l,p+power(2,l),lv+1 from t1,t where a<l and lv<6),
a as(select p pa from t1 where lv=6),
b as(select pa pb from a),
s as(select power(2,substr('0104061625364618',level*2-1,1))s1,
power(2,substr('0104061625364618',level*2,1))s2 from dual connect by level<=8),
j as(select pa,pb from a,b where pa<pb and not exists(select 1 from s where bitand(pa,s1)*bitand(pb,s2) =0
and bitand(pa,s2)*bitand(pb,s1)=0))
select count(*) from (
select pa,pb from j
union
select least(pa-64+512,pb),greatest(pa-64+512,pb) from j where bitand(pa,512)=0 and bitand(pa,64)<>0
union
select least(pa,pb-64+512),greatest(pa,pb-64+512) from j where bitand(pb,512)=0 and bitand(pb,64)<>0
union
select pa-64+512,pb-64+512 from j where bitand(pb,512)=0 and bitand(pb,64)<>0 and bitand(pa,512)=0 and bitand(pa,64)<>0
);
|
|