68分求解!!!
查看原帖
68分求解!!!
1224675
qx_wuwenxuan楼主2024/12/4 12:59
#include<bits/stdc++.h>
using namespace std;
double a;
double f(double x){
	if(x>=0 && x<5) return -x+2.5;
	else if(x>=5 && x<10) return 2-15*(x-3)*(x-3);
	else if(x>=10 && x<20) return x/2-1.5;
}
int main (){
	cin>>a;
	printf("%.3lf",f(a));
	return 0;
}
2024/12/4 12:59
加载中...