【问题描述】
用3.5元买10分、20分、50分面额邮票共18枚,其中10分邮票与20分邮票的总面值相等,求三种邮票各买几枚(三种面额的都要有)?
【输入形式】
【输出形式】
【样例输入】
【样例输出】
购买10分面额的邮票10枚,20分面额的邮票5枚,50分面额的邮票3枚。
【样例说明】
【评分标准】
def buy_stamps(total_money, total_stamps):
for i in range(total_money // 10 + 1):
for j in range(total_money // 20 + 1):
for k in range(total_money // 50 + 1):
if i + j + k == total_stamps and 10*i + 20*j + 50*k == total_money and i > 0 and j > 0 and k > 0 and 10*i == 20*j:
return i, j, k
return None
total_money = int(3.5 * 100)
total_stamps = 18
result = buy_stamps(total_money, total_stamps)
print(f"购买10分面额的邮票{result[0]}枚,20分面额的邮票{result[1]}枚,50分面额的邮票{result[2]}枚。")