Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
36949 jiabokai 分段函数 C++ 解答错误 0 MS 240 KB 283 2024-01-18 14:39:22

Tests(0/1):


#include<bits/stdc++.h> using namespace std; double y,z; int f(int x){ if(0<=x&&x<5){ y=-x+2.5; } if(5<=x&&x<10){ y=2-1.5*(x-3)*(x-3); } if(10<=x&&x<20){ y=x/2-1.5; } return y; } int main() { cin>>z; cout<<fixed<<setprecision(3)<<f(z); return 0; }


测评信息: