Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
229968 陆沛埦 *小美的外卖订单 C++ 解答错误 80 0 MS 428 KB 548 2024-01-07 14:27:58

Tests(4/5):


#include <bits/stdc++.h> using namespace std; long long n; double a[100002],b[100002]; double sum,t,m,total; bool d=false; int main() { scanf("%lld",&n); for(int i=1; i<=n; i++) { scanf("%lf%lf",&a[i],&b[i]); if(b[i]>a[i]||a[i]<=0||b[i]<=0) d=true; sum+=b[i]; total+=a[i]; } scanf("%lf%lf",&t,&m); if(m>t) { printf("error\n"); return 0; } if(d==true) { } if(total>=t) total-=m; if(total<=0||sum<=0) { printf("error\n"); return 0; } printf("%.2lf\n",min(total,sum)); return 0; }


测评信息: