#include<iostream>
#include<algorithm>
using namespace std;
struct Dota
{
double DPS;
double HP;
}hero[50];
bool cmp(Dota h1,Dota h2)
{
return h1.DPS/h1.HP>h2.DPS/h2.HP;
}
int main()
{
int n,i;
__int64 sum,total;
while(~scanf("%d",&n))
{
total=0;
for(i=0;i<n;i++)
{
scanf("%lf %lf",&hero[i].HP,&hero[i].DPS);//质疑先输入血量还是伤害值?
total+=hero[i].DPS;
}
sort(hero,hero+n,cmp);
sum=0;
for(i=0;i<n;i++)
{
sum+=hero[i].HP*total;
total-=hero[i].DPS;
}
printf("%I64d\n",sum);
}
return 0;
}
tjut 4310
最新推荐文章于 2016-08-31 17:14:15 发布