“百马百瓦问题”,有100匹马驮100块瓦,大马驮3块,小马驮2块、两个马驹驮1块。问大马、小马、马驹各有多少匹?
参考代码
@author: Catwang
"""
for x in range(1,34):
for y in range(1,51):
for z in range(100):
if 3*x+2*y==100-z/2:
if x+y+z==100:
print("大马有",x,"小马有",y,"马驹有",z)
运行结果