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 |
错在哪里?#include <stdio.h> #include <string.h> int main() { int total,distance,flag; char start[100],dest[100],style; while(1) { flag=0; total=0; while(1) { scanf("%s",start); if(!strcmp(start,"0")) break; if(!strcmp(start,"#")) { flag=1; break; } scanf("%s %d %c",dest,&distance,&style); switch(style) { case'F': { total+=2*distance; break; } case'B': { if(distance%2) total+=distance+distance/2+1; else total+=distance+distance/2; break; } case'Y': { if(distance<=500) total+=500; else total+=distance; break; } } } printf("%d\n",total); if(flag) break; } return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator