| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 436172 | 沈昊坤 | 【C6-7】阿里巴巴与四十大盗 | C++ | 解答错误 | 0 | 1 MS | 268 KB | 443 | 2026-04-11 20:17:04 |
#include<bits/stdc++.h> using namespace std; int main(){ int x,n,s=0; cin>>n>>x; int a[10086],b[10086],c[10086]; for(int j=1;j<=n;j++){ cin>>a[j]>>b[j]; c[j]=1.0*b[j]/a[j]; } sort(c+1,c+n+1,greater<int>()); for(int j=1;j<=n;j++){ if(x<=0){ break; } if(x>0&&x>=a[j]){ x-=a[j]; s+=a[j]*c[j]; }else{ s+=x*c[j]; } } cout<<fixed<<setprecision(1)<<s; return 0; }