当样例通过时,蒟蒻欢欢喜喜的提交上去,结果听取WA声一片
code:
#include <bits/stdc++.h>
using namespace std;
double a[105], da = 0;
int n, t, x[105], y[105];
int main(){
scanf("%d %d", &n, &t);
for(int i = 0;i<=n - 1;i++){
scanf("%d %d", &x[i], &y[i]);
a[i] = (double)y[i] / (double)x[i];
}
sort(a, a + n, greater<int>());
for(int i = 0;i<=n - 1;i++){
while(t>0&&x[i]>0){
t--;
da += a[i];
x[i]--;
}
}
printf("%.2lf", da);
return 0;
}
向大佬们求助。