我人傻了,第一个点为啥RE了啊??
球球球巨佬来帮帮忙,或者能否给下第一个点的数据
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct money_type
{
int m, v;
double k;
}m[1001];
bool my_cmp(money_type a, money_type b)
{
if(a.k > b.k)
return true;
else return false;
}
int main()
{
int i, t, n;
cin >> n >> t;
for(i = 0; i < n; i++)
{
cin >> m[i].m >> m[i].v;
m[i].k = double(m[i].v) / m[i].m;
}
sort(m,m + n,my_cmp);
i = 0;
double s = 0;
while(t > 0)
{
if(t >= m[i].m)
{
t -= m[i].m;
s += m[i].v;
}
else
{
s += m[i].k * t;
t = 0;
}
i++;
}
printf("%.2f\n", s);
return 0;
}