Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
234748 1145展诚 *小美的外卖订单 C++ 通过 100 4 MS 432 KB 525 2024-01-29 19:41:58

Tests(5/5):


#include <iostream> #include <iomanip> using namespace std; int n; double a[100005], b[100005]; int main() { cin >> n; double aans(0), bans(0); for (int i = 1; i <= n; i++) { cin >> a[i] >> b[i]; if (b[i] > a[i] || a[i] < 0 || b[i] < 0) { cout << "error"; return 0; } aans += b[i]; bans += a[i]; } double x, y; cin >> x >> y; if (y > x || y < 0 || x < 0) { cout << "error"; return 0; } if (bans >= x) bans -= y; cout << fixed << setprecision(2) << min(aans, bans); }


测评信息: