代码:
11 121
12 144
13 169
14 196
15 225
16 256
17 289
18 324
19 361
20 400
21 441
22 484
23 529
24 576
25 625
26 676
27 729
28 784
29 841
30 900
31 961 ...................
代码:
13 169
14 196
16 256
17 289
18 324
19 361
23 529
24 576
25 625
27 729
28 784
29 841
31 961
。。。。
假设其中一个数含有169,那其他数字中不含这三个数的只有324和784,显然不能满足题目要求
故169、196、961均被排除
……
如此分析下去,最后得到
361
529
784
而且仅此一解(按大小顺序排列)
【Oracle SQL】
9i下可用
SQL> with a as (select rm from
(select rownum*rownum rm from dual connect by rownum<32)
where substr(rm,1,1)<>substr(rm,2,1) and substr(rm,2,1)<>substr(rm,3,1)and substr(rm,3,1)<>substr(rm,1,1)),
b as (select a.rm||b.rm||c.rm t from a a,a b, a c where a.rm
(select t, instr(b.t,c.ch) i from b, (select rownum ch from dual connect by rownum<10) c
where instr(b.t,c.ch)>0)
group by t having count(*)=9;
RESULT
------------
361,529,784
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29867/viewspace-811934/ ,如需转载,请注明出处,否则将追究法律责任。