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

感觉自己没有写错呀~给的数据还有讨论的测试的数据都过了为什么还是wa

Posted by hyhy3761 at 2015-04-06 21:03:27 on Problem 1922
#include<iostream>
#include<math.h>
using namespace std;
struct p{
       int v;
       int t;
      double tt;
       };
int com(const void *a,const void *b)
       {
              struct p *aa,*bb;
              aa=(struct  p*)a;
              bb=(struct p *)b;
              return int((*aa).tt-(*bb).tt);
              }
int main()
{
    int n,m,i,j;
    struct p ps[10000];
    while(cin>>n&&n!=0)
    {
                       for(i=0;i<n;i++){                       
                       cin>>ps[i].v>>ps[i].t;
                       if(ps[i].t<0)
                       ps[i].tt=0;
                       else
                       ps[i].tt=(4500*3.6/ps[i].v)+ps[i].t;
                       }
    qsort(ps,n,sizeof(p),com); 
    for(i=0;i<n;i++)
    if(ps[i].tt!=0)
    break;    
    int k=ceil(ps[i].tt);
    cout<<k<<endl;
    }
}
    

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