求大佬调试
查看原帖
求大佬调试
755412
DPG_DPG123楼主2023/7/10 11:20

https://www.luogu.com.cn/record/114674708

# include <iostream>
using namespace std;
double f(double x){
    if (0 <= x < 5) return -x + 2.5;
    else if (5 <= x < 10) return 2 - 1.5 * (x-3) * (x-3);
    else if (10 <= x < 20) return x / 2.0 - 1.5;
}
int main(){
    double n;
    cin >> n;
    printf("%.3lf", f(n));
    return 0;
}
2023/7/10 11:20
加载中...