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 |
水题,1A,附代码#include <stdio.h> int main() { int h,m,s,hh=0,mm=0,ss=0,speed=0; double distance=0; char c; while(scanf("%d:%d:%d",&h,&m,&s)!=EOF) { distance+=(h-hh)*speed+(m-mm)*speed/60.0+(s-ss)*speed/3600.0; hh=h,mm=m,ss=s; if(c=getchar()==' ') scanf("%d",&speed); else { if(h<10) printf("0%d:",h); else printf("%d:",h); if(m<10) printf("0%d:",m); else printf("%d:",m); if(s<10) printf("0%d ",s); else printf("%d ",s); printf("%.2lf km\n",distance); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator