gsc15759915601 @ 2023-07-09 12:14:01
#include<bits/stdc++.h>
using namespace std;
long long n,x,y,z;
long double m;
int main(){
cin>>n;
if(n>150){
m = 150*0.4463*0.0001;
if(n>400){
m = 250*0.4663*0.0001+m;
cout<<fixed<<setprecision(1)<<m+(n-400)*0.4663;
}else{
cout<<fixed<<setprecision(1)<<m+(n-150)*0.5663;
}
}else{
cout<<fixed<<setprecision(1)<<n*0.4463;
}
return 0;
}
by ToastBread @ 2023-07-09 13:05:25
#include<bits/stdc++.h>
using namespace std;
long long n,x,y,z;
long double m;
int main(){
cin>>n;
if(n>150){
m = 150*0.4463;
if(n>400){
m = 250*0.4663+m;
cout<<fixed<<setprecision(1)<<m+(n-400)*0.5663;
}else{
cout<<fixed<<setprecision(1)<<m+(n-150)*0.4663;
}
}else{
cout<<fixed<<setprecision(1)<<n*0.4463;
}
return 0;
}
改了的
修了你m*0.0001(why?)
by I_like_LCH @ 2023-07-09 13:07:08
@gsc15759915601
#include<bits/stdc++.h>
using namespace std;
long long x,y,z;
double m=0,n;
int main(){
cin>>n;
if(n>150)
{
m = 150*0.4463;
if(n>400)
{
m = 250*0.4663+m;
cout<<fixed<<setprecision(1)<<m+(n-400)*0.5663;
}
else
{
cout<<fixed<<setprecision(1)<<m+(n-150)*0.4663;
}
}
else
{
cout<<fixed<<setprecision(1)<<n*0.4463;
}
return 0;
}
你的4663和5663反了
by ToastBread @ 2023-07-09 13:07:56
#include<bits/stdc++.h>
using namespace std;
long long n,x,y,z;
long double m;
int main(){
cin>>n;
if(n>150){
m = 150*0.4463*0.0001;//为什么*0.0001?
if(n>400){
m = 250*0.4663*0.0001+m;//同上
cout<<fixed<<setprecision(1)<<m+(n-400)*0.4663;
}else{
cout<<fixed<<setprecision(1)<<m+(n-150)*0.5663;
}
}else{
cout<<fixed<<setprecision(1)<<n*0.4463;
}
return 0;
}
你的M是底价,应该不(了会让结果小很多)
by gsc15759915601 @ 2023-07-09 13:08:44
*0.0001是为了提升精度,不过谢谢二位。
by ToastBread @ 2023-07-09 13:09:04
@I_like_LCH 谢谢改正 但不调也能过(
by ToastBread @ 2023-07-09 13:10:50
@gsc15759915601 你最后要*回来,注意下
by I_like_LCH @ 2023-07-09 13:11:22
@ToastBread 这数据……
by ToastBread @ 2023-07-09 13:12:18
@I_like_LCH 数据太水了
by I_like_LCH @ 2023-07-09 13:13:38
@ToastBread 雀食