文章
4
粉丝
11
获赞
2
访问
5.0k
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x;
while(scanf("%d", &x) != EOF)
{
double discount = 0, pay = 0;
if(x <= 1000) discount = 1;
else if (x > 1000 && x <= 2000) discount = 0.95;
else if (x > 2000 && x <= 3000) discount = 0.9;
else if (x > 3000 && x <= 5000) discount = 0.85;
else discount = 0.8;
pay = x * discount;
printf("discount=%g,pay=%g\n", discount, pay);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发