解题思路:条件判断
注意事项:这里自己写了一个四舍五入,直接用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语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:710 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:643 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:662 |
简单编码 (C++代码)浏览:678 |
高精度加法 (C++代码)(大数加法)浏览:934 |
本人酷爱递归实现很多问题,这里也是浏览:557 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:635 |
sizeof的大作用 (C语言代码)浏览:1452 |
sizeof的大作用 (C语言代码)浏览:1028 |
小九九 (C语言描述,不看要求真坑爹)浏览:985 |