Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
104463 陈治宸 11计算分段函数的值 C++ Wrong Answer 1 MS 276 KB 432 2025-01-05 10:30:11

Tests(3/10):


Code:

#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; }


Run Info:

------Input------
7.8
------Answer-----
-12.400
------Your output-----
-32.560