| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
感觉自己没有写错呀~用了longlong为什么还是wa#include<iostream>
using namespace std;
struct h
{
long long t;
long long d;
double l;
};
int com(const void *a,const void *b)
{
struct h *aa,*bb;
aa=(struct h *)a;
bb=(struct h *)b;
return (int)((*aa).l-(*bb).l);
}
int main()
{ int i ,j,n;
long long ti,f;
struct h hs[100000];
cin>>n;
for(i=0;i<n;i++)
{
cin>>hs[i].t>>hs[i].d;
hs[i].l=(hs[i].t*100.00)/hs[i].d;
}
qsort(hs,n,sizeof(h),com);
ti=0;
f=0;
for(i=0;i<n;i++)
{
f+=ti*hs[i].d;
ti+=2*hs[i].t;
}
cout<<f;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator