文章
4
粉丝
181
获赞
0
访问
37.7k
#include<stdio.h>
#define c1 1e5*10e-2
#define c2 (2e5-1e5)*7.5e-2
#define c3 (4e5-2e5)*5e-2
#define c4 (6e5-4e5)*3e-2
#define c5 (1e6-6e5)*1.5e-2
int main()
{
int a, b;
scanf("%d", &a);
if (a >= 0)
{
if (a <= 1e5)
b = a * 10e-2;
else if (a > 1e5 && a <= 2e5)
b = c1 + (a - 1e5) * 7.5e-2;
else if (a > 2e5 && a <= 4e5)
b = c1 + c2 + (a - 2e5) * 5e-2;
else if (a > 4e5 && a <= 6e5)
b = c1 + c2 + c3 + (a - 4 * 1e5) * 3e-2;
else if (a > 6e5 && a <= 1e6)
b = c1 + c2 + c3 + c4 + (a - 6e5) * 1.5e-2;
else
b = c1 + c2 + c3 + c4 + c5 + (a - 1e6) * 1e-2;
}
else if(a<0)
printf("error\n");
printf("%d", b);
return 0;
}
登录后发布评论
暂无评论,来抢沙发