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 |
why i got ce by g++ but ac with c#include<stdio.h> #include<string.h> int main() { long int dui,n,b,a,flag,not,ten,i,j,k,l; double d,p; char s[21][10]; scanf("%ld%lf",&n,&d); i=0; while((scanf("%ld",&dui))==1) { scanf("%s",s[i]); l=strlen(s[i]); flag=0; for(j=0;j<l;j++) if(s[i][j]==':') {flag=1;break;} if(flag) { for(i=1;i<n;i++) scanf("%s",s[i]); p=0; not=0; for(i=0;i<n;i++) { if(s[i][6]=='-') {not=1;break;} p+=(s[i][6]-48+10*(s[i][5]-48))/60.0+s[i][3]-48+10*(s[i][2]-48)+(s[i][0]-48)*60.0; } p/=d; printf("%3ld: ",dui); if(!not) { a=(long)p; b=(long)((p-a)*60); if((p-a)*60-b>=0.5) { b++; if(b==60) { b=0; a++; } } printf("%ld:",a); if(b<10) printf("0"); printf("%ld min/km\n",b); } else printf("-\n"); i=0; } else { n=dui; d=(s[0][l-1]-48)/10.0; ten=1; for(k=l-3;k>=0;k--) { d+=(s[0][k]-48)*ten; ten*=10; } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator