大会员可查看代码,点此开通大会员
#include <bits/stdc++.h>
using namespace std;
int main(){
float cost;
float discount;
float pay;
int t;
while(scanf("%f",&cost)!=EOF){
t=(int)cost/1000;
switch(t){
case 0: discount=1;
break;
case 1: discount=0.95;
break;
case 2: discount=0.9;
break;
case 3:
case 4: discount=0.85;
break;
default:discount=0.8;
break;
}
pay =cost*discount;
printf("discount=%g,pay=%g\n",discount,pay);
}
return 0;
}