http://lx.lanqiao.cn/problem.page?gpid=T321
#include <bits/stdc++.h>
using namespace std;
const int maxn=10005;
const int INF=0x3f3f3f3f;
int n,m;
struct Node{
int w;
double v;
bool operator <(Node obj) const{
return v>obj.v;
}
}node[maxn];
int main(){
cin >> n >> m;
for (int i=0;i<n;i++){
int x;
double y;
cin >> x >> y;
node[i].w=x;
node[i].v=y/x;
}
sort(node,node+n);
int i=0;
double ans=0;
while (m){
if (m>=node[i].w){
ans+=node[i].w*node[i].v;
m-=node[i].w;
i++;
}
else{
ans+=m*node[i].v;
m=0;
}
}
printf("%.1lf",ans);
}