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

我发表一个标准答案 呵呵 有问题找我 大家分享

Posted by cpp050200448253 at 2005-04-04 18:49:28 on Problem 1922
#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:
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