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 |
郁闷得很!为什么是WA呢?如果算出m>=60,怎么处理呢?#include<stdio.h> #include<string.h> int main() { int n,h,mm,ss,i,t; double d,time; char s[100000]; while(gets(s)) { for(i=0;s[i];i++) if(s[i]==':') break; if(s[i]=='\0') sscanf(s,"%d%lf",&n,&d); else { sscanf(s,"%d",&t); for(i=0;s[i];i++) if(s[i]=='-') break; if(s[i]){printf("%3d: -\n",t);continue;} time=0; printf("%3d: ",t); for(i=0;i<n;i++) { sscanf(s+4+i*7,"%d:%d:%d",&h,&mm,&ss); time+=h*3600+mm*60+ss; } time/=d; time=(int)(time+0.5); mm=(int)(time/60);ss=time-mm*60; printf("%d:%02d min/km\n",mm,ss); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator