|
人肉一下一位数
一位数:0~9,和的范围是0~18,共计19个不同的结果
任取两个数,说明取的先后没有顺序关系,所以总共是100种取法,而不需要去除诸如1,1/4,4/5,5等等看似重复的取法
下面开始验证:
1 with t as (select level-1 n from dual where level >0 connect by level <=10) --0 也是一位数
2 , u as (select a.n+b.n s, count(*) cnt from t a, t b group by a.n+b.n) --和的个数
3 , v as (select sum(power(cnt,2)) fz, power(power(10,2),2) fm from u )
4* select fz, fm, fz/fm, 29/405 from v
SCOTT@lw.lw2> /
FZ FM FZ/FM 29/405
---------- ---------- ---------- ----------
670 10000 .067 .071604938
1 with t as (select level n from dual where level >0 connect by level <10) --0 难道不是一位数?
2 , u as (select a.n+b.n s, count(*) cnt from t a, t b group by a.n+b.n) --和的个数
3 , v as (select sum(power(cnt,2)) fz, power(power(10,2),2) fm from u )
4* select fz, fm, fz/fm, 29/405 from v
SCOTT@lw.lw2> /
FZ FM FZ/FM 29/405
---------- ---------- ---------- ----------
489 10000 .0489 .071604938
我去,看来拿3,4和拿4,3视作同一种取法
1 with t as (select level-1 n from dual where level >0 connect by level <=10) --看来0应该是一位数
2 , u as (select a.n+b.n s, count(*) cnt from t a, t b where a.n<=b.n group by a.n+b.n) --和的个数,3,4和4,3视作同一种取法
3 , v as (select sum(power(cnt,2)) fz, power(55,2) fm from u )
4* select fz, fm, fz/fm, 29/405 from v
SCOTT@lw.lw2> /
FZ FM FZ/FM 29/405
---------- ---------- ---------- ----------
195 3025 .06446281 .071604938
1 with t as (select level n from dual where level >0 connect by level <10) --0真的不是一位数,FT
2 , u as (select a.n+b.n s, count(*) cnt from t a, t b where a.n<=b.n group by a.n+b.n) --和的个数,3,4和4,3视作同一种取法
3 , v as (select sum(power(cnt,2)) fz, power(45,2) fm from u )
4* select fz, fm, fz/fm, 29/405 from v
SCOTT@lw.lw2> /
FZ FM FZ/FM 29/405
---------- ---------- ---------- ----------
145 2025 .071604938 .071604938
|
|