#include <bits/stdc++.h>
using namespace std;
struct gold{
double w,g;
double v;
}gd[1000];
bool cmp(gold a,gold b){
return a.v>b.v;
}
int main(){
int n,t;
double ans=0;
cin>>n>>t;
for (int i=0;i<n;i++){
cin>>gd[i].w>>gd[i].g;
gd[i].v=gd[i].g*1.0/(gd[i].w*1.0);
}sort(gd,gd+n,cmp);
int i=0;
while (t){
if (t<=0)break;
ans+=gd[i].g;
t-=gd[i].w;
i++;
}printf("%.2lf",ans-(t*(-1.0)*gd[--i].v));
return 0;
}
第一点RE,有人看看吗?