Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

感觉自己没有写错呀~用了longlong为什么还是wa

Posted by hyhy3761 at 2015-04-06 19:46:27 on Problem 3262
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator