问题及代码:
/*
Copyright (c) 2014,烟台大学计算机学院
All rights reserved.
文件名称:test.cpp
作 者:张学伟
完成日期:2016年10月16日
版 本 号:v1.0
运行过程:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int l,a;
scanf("%d",&l);
if(l<=100000)
{
a=l*0.1;
}
else if(l>100000&&l<=200000)
{
a=100000*0.1+(l-100000)*0.075;
}
else if(l>200000&&l<=400000)
{
a=100000*0.1+100000*0.075+(l-200000)*0.05;
}
else if(l>400000&&l<=600000)
{
a=100000*0.1+100000*0.075+200000*0.05+(l-400000)*0.03;
}
else if(l>600000&&l<=1000000)
{
a=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(l-600000)*0.015;
}
else
{
a=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(l-1000000)*0.01;
}
printf("%d\n",a);
return 0;
}
运行结果: