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了,各位高手帮忙看一下!非常感谢了!#include "iostream" using namespace std; #define N 20 int main() {char OriCity[N],DistCity[N],ClassCode,c; int Actual_miles,sum; while(c!='#') { sum=0; while(cin.peek()!='0') { scanf("%s %s %d %c",OriCity,DistCity,&Actual_miles,&ClassCode); getchar(); if(ClassCode=='F')sum+=Actual_miles*2; else if(ClassCode=='B')sum+=Actual_miles+(Actual_miles+1)/2; else if(ClassCode=='Y') { if(Actual_miles<=500)sum+=500; else sum+=Actual_miles; } } getchar(); cout<<sum<<endl; cin>>c; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator