16分蒟蒻,帮帮
查看原帖
16分蒟蒻,帮帮
695644
Mizuki0322楼主2023/12/30 23:57
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define int long long
double n,ans;
inline double f(double x){
	int y;
	if (x>=0 && x<5){
		y=-x+2.5;
	}else if (x>=5 && x<10){
		y=2-1.5*(x-3)*(x-3);
	}else{
		y=x/2-1.5;
	}
	return y;
}
signed main(){
	#ifndef ONLINE_JUDGE
		freopen("nightingale.in","r",stdin);
		freopen("nightingale.out","w",stdout);
	#endif
	scanf("%lf",&n);
	ans=f(n);
	printf("%.3lf",ans);
	return 0;
}

2023/12/30 23:57
加载中...