代练2023


私信TA

用户名:dotcpp0637745

访问量:145

签 名:

等  级
排  名 11987
经  验 946
参赛次数 0
文章发表 2
年  龄 0
在职情况 学生
学  校 桂林学院
专  业

  自我简介:

TA的其他文章

解题思路:条件判断

注意事项:这里自己写了一个四舍五入,直接用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 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区