解题思路:条件判断
注意事项:这里自己写了一个四舍五入,直接用int也一样
参考代码:
s = int(input())
def round(x):
x = str(x)
if x[x.index('.')+1]<='4':
return int(x[0:x.index('.')])
else:
return int(x[0:x.index('.')])+1
if s<=100000:
print(round(s*0.1))
elif 100000<s<=200000:
print(round(100000*0.1+((s-100000)*0.075)))
elif 200000<s<=400000:
print(round(100000*0.1+100000*0.075+((s-200000)*0.05)))
elif 400000<s<=600000:
print(round(100000*0.1+100000*0.075+200000*0.05+((s-400000)*0.03)))
elif 600000<s<=1000000:
print(round(100000*0.1+100000*0.075+200000*0.05+200000*0.03+((s-600000)*0.015)))
elif s>1000000:
print(round(100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+((s-1000000)*0.01)))
0.0分
3 人评分
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:599 |
陶陶摘苹果 (C语言代码)浏览:1606 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:775 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:1058 |
众数问题 (C语言代码)浏览:830 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:514 |
杨辉三角 (C语言代码)浏览:679 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:563 |
素数的个数 一直是超时浏览:668 |
C语言训练-求车速 (C语言代码)浏览:809 |