srl2000 提交的代码
提交时间:2021年3月25日 15:13 语言:C++运行时间:0ms占用内存:253K
运行状态: Accepted
题目:促销计算1091

大会员可查看代码,点此开通大会员

                
                    #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;
}