CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day01-15/code/Day05/chicken.py
Views: 729
1
"""
2
求解《百钱百鸡》问题
3
1只公鸡5元 1只母鸡3元 3只小鸡1元 用100元买100只鸡
4
问公鸡 母鸡 小鸡各有多少只
5
6
Version: 0.1
7
Author: 骆昊
8
Date: 2018-03-02
9
"""
10
11
for x in range(0, 20):
12
for y in range(0, 33):
13
z = 100 - x - y
14
if 5 * x + 3 * y + z / 3 == 100:
15
print('公鸡: %d只, 母鸡: %d只, 小鸡: %d只' % (x, y, z))
16
17