| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 50543 | 韩逸宸 | 2023经开区信息技术合格性考试-1 | Python3 | 通过 | 100 | 52 MS | 4476 KB | 530 | 2024-12-24 15:10:05 |
def calculate_discount(total_amount): if total_amount < 2000: discount = 0 elif 2000 <= total_amount < 3000: discount = 0.20 # 8折优惠,即20%的折扣 elif 3000 <= total_amount < 4000: discount = 0.30 # 7折优惠,即30%的折扣 else: discount = 0.40 # 6折优惠,即40%的折扣 return total_amount * (1 - discount) # 测试程序 total_amount = float(input()) discounted_price = calculate_discount(total_amount) print(f"{discounted_price:.1f}")