top1编程
← 返回题目
题解

【入门】超市 大打折

1 条题解

  • 0
    @ 2026-7-29 0:18:04
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        double a;
        cin>>a;
        if(a>=500){
        	cout<<fixed<<setprecision(2)<<a*0.8;
    	}
    	else if(300<=a<500){
    		cout<<fixed<<setprecision(2)<<a*0.9;
    	}else{
    		cout<<fixed<<setprecision(2)<<a;
    	}
    	return 0;
    }
    
    • 1