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 zerotext at 2006-03-05 12:41:30 on Problem 1922
#include<stdio.h>
struct student
{
	int kph;
	int time;
	int get;
}stu[10000];
int main()
{
	int n,i,inttemp,min,con=360*45;
	double doutemp;
	while(1)
	{
		scanf("%d",&n);
		if(n==0)
			break;
		for(i=0;i<n;i++)
		{
			scanf("%d%d",&stu[i].kph,&stu[i].time);
			inttemp=con/stu[i].kph;
			doutemp=con/(double)stu[i].kph;
			if(doutemp==(double)inttemp)
				stu[i].get=inttemp;
			else
				stu[i].get=inttemp+1;
			if(stu[i].time>=0)
				if(0==i)
					min=stu[i].get+stu[i].time;
				else
					if(stu[i].get+stu[i].time<min)
						min=stu[i].get+stu[i].time;
		}
		printf("%d\n",min);
	}
	return 0;
}

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