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 |
我发表一个标准答案 呵呵 有问题找我 大家分享#include <iostream.h> #include <stdlib.h> #include <math.h> int cmp ( const void *a ,const void *b ) { return *(int*)a - *(int*)b; } void main() { int sudu[10000],time[10000],result[10000]; while(1) { int n; cin>>n; if(n!=0) { int i=0,j; for(i=0,j=0;i<n;i++,j++) { cin>>sudu[j]>>time[j]; if (time[j]<0) j--; result[j] = ceil((4.5/sudu[j])*3600)+time[j]; } qsort(result,j,sizeof(int),cmp); //排序后第一个就是最小值拉 cout<<result[0]<<endl; } else return; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator