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

+1

Posted by 3Dnn at 2013-04-15 21:43:25 on Problem 2501 and last updated at 2013-04-15 21:44:26
In Reply To:贴个AC的代码 Posted by:scut_hcy at 2013-01-29 17:37:27
//poj 2501
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

char ch[250];

int main()
{
	double h=0,m=0,s=0,t=0,sum=0,d=0;
	int i,j,v=0;
	while(scanf("%lf:%lf:%lf",&h,&m,&s)!=EOF)
	{
		memset(ch,NULL,sizeof(ch));
		gets(ch);
		if(ch[0]==NULL)
		{
			sum=((h*3600+m*60+s-t)*(v/3.6))/1000.0;
			printf("%02d:%02d:%02d %.2lf km\n",(int)h,(int)m,(int)s,sum+d);
		}
		else if(ch[0]==' ')
		{
			d+=(h*3600+m*60+s-t)*(v/3.6)/1000.0;
			v=atoi(ch);
			t=h*3600+m*60+s;
		}
	}
	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