百元买百鸡问题
一只公鸡五文钱,一只母鸡三文钱,三只小鸡一文钱,要用一百文钱刚好买一百只鸡,问公鸡、母鸡和小鸡各买多少只?
鸡翁一,值钱五,鸡母一,值钱三,鸡雏一,值钱一,百钱买百鸡,问鸡翁,鸡母,鸡雏各几何?
```
buy_plan = 0
for cock in range(20):
for hen in range(34):
for chick in range(300):
if cock*5 + hen*3 + chick/3 == 100 and cock+hen+chick == 100:
buy_plan += 1
print(f"第{buy_plan}方案: cock_num:{cock}, hen_num:{hen}, chick_num:{chick}")
print('---')
buy_plan = 0
for cock in range(20):
for hen in range(34):
chick = 100 - cock - hen
if cock*5 + hen*3 + chick/3 == 100:
buy_plan += 1
print(f"第{buy_plan}方案: cock_num:{cock}, hen_num:{hen}, chick_num:{chick}")
第1方案: cock_num:0, hen_num:25, chick_num:75
第2方案: cock_num:4, hen_num:18, chick_num:78
第3方案: cock_num:8, hen_num:11, chick_num:81
第4方案: cock_num:12, hen_num:4, chick_num:84
```