题目
已知:
- 母鸡5元1只
- 公鸡3元1只
- 小鸡1元3只
现在有100元要买100只鸡 请问有几种可能?
解答
SQL> with dao_temp as
2 (select level - 1 c1 from dual connect by level <= 101)
3 select gongji.c1 gongji,
4 muji.c1 muji,
5 xiaoji.c1 xiaoji
6 from dao_temp gongji, dao_temp muji, dao_temp xiaoji
7 where gongji.c1 + muji.c1 + xiaoji.c1 = 100
8 and gongji.c1 * 3 + muji.c1 * 5 + xiaoji.c1 / 3 = 100
9 and mod(xiaoji.c1, 3) = 0 ;
GONGJI MUJI XIAOJI
---------- ---------- ----------
4 12 84
11 8 81
18 4 78
25 0 75