#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
const int N=102;
int n,zhilian;
struct gold{
double weight;
double worth;
double every;
}go[N];
bool compair(gold a,gold b){
return a.every>b.every;
}
int main(){
cin>>n>>zhilian;
int i=0;
int t=n;
while(t--){
int x1,x2;
scanf("%d%d",&x1,&x2);
go[i].weight=x1,go[i].worth=x2;
go[i].every=(double)x2/x1;
i++;
}
sort(go,go+n,compair);
double res=0;
for(int j=0;j<n;j++){
if(zhilian>go[j].weight) res+=go[j].worth,zhilian-=go[j].weight;
else {
res+=go[j].every*zhilian;
break;
}
}
printf("%.2lf",res);
return 0;
}
0 回复
0 转发
0 喜欢
2 阅读



