Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
51602 张思存 分段函数 C++ Accepted 0 MS 256 KB 376 2024-09-22 21:44:48

Tests(1/1):


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


Judgement Protocol: