Run ID:104463
提交时间:2025-01-05 10:30:11
#include<iostream> #include<iomanip> using namespace std; int main() { double n, y1, y2, y3; cin >> n; if (0 <= n && n < 5) { y1 = -n + 2.5; cout << fixed << setprecision(3) << y1 << endl; } if (5 <= n && n < 10) { y2 = 2 - 1.5 * (n - 3) * (n - 3); cout << fixed << setprecision(3) << y2 << endl; } if (10 <= n && n < 20) { y3 = 1.0 * n / 2 - 1.5; cout << fixed << setprecision(3) << y3 << endl; } return 0; }