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 |
这是我的代码:In Reply To:我也是~数据有问题吧~~~ Posted by:tq at 2005-07-14 20:00:15 #include <stdio.h> #include <string.h> #include <math.h> main() { char s1[300],s2[300]; double mile; char type[5]; double tot; scanf("%s", s1); while (s1[0]!='#' ) { tot=0; while (s1[0]!='0') { scanf("%s",s2); scanf("%lf", &mile); scanf("%s", type); if (type[0]=='F') { tot+=2*mile; } else if (type[0]=='B') { tot+=1.5*mile; } else if (type[0]=='Y') { if (mile<500) { tot+=500; } else { tot+=mile; } } scanf("%s", s1); } printf("%.0lf\n",tot); scanf("%s", s1); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator