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 |
+1In 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator