2 条题解

  • 1
    @ 2026-3-15 20:49:22

    普通的if语句 (代码有亿点长,细品)

    #include<bits/stdc++.h>
    using namespace std;
    
    int main(){
    	int n;
    	cin>>n;
    	if(n<=100000){
    		cout<<fixed<<setprecision(2)<<n*0.1;
    	}
    	if(100000<n&&n<=200000){
    		cout<<fixed<<setprecision(2)<<10000+(n-100000)*0.075;
    	}
    	if(200000<n&&n<=400000){
    		cout<<fixed<<setprecision(2)<<17500+(n-200000)*0.05;
    	}
    	if(400000<n&&n<=600000){
    		cout<<fixed<<setprecision(2)<<27500+(n-400000)*0.03;
    	}
    	if(600000<n&&n<=1000000){
    		cout<<fixed<<setprecision(2)<<33500+(n-600000)*0.015;
    	}
    	if(1000000<n){
    		cout<<fixed<<setprecision(2)<<39500+(n-1000000)*0.01;
    	}
    	return 0;
    }
    
    

信息

ID
860
时间
1000ms
内存
128MiB
难度
5
标签
递交数
106
已通过
37
上传者