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 |
感觉自己没有写错呀~给的数据还有讨论的测试的数据都过了为什么还是wa#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator