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 |
贴个AC的代码#include<iostream> #include<string> using namespace std; int main() { string s; int allmile=0; int earn; int mileage; char classcode; while(cin>>s) { if(s[0]=='#') break; else if(s[0]=='0') { cout<<allmile<<endl; allmile=0; continue; } cin>>s; cin>>mileage; cin>>classcode; if(classcode=='F') earn=2*mileage; else if(classcode=='B') { if(mileage%2==0) earn=1.5*mileage; else earn=1.5*mileage+1; } else if(classcode=='Y') { if(mileage<500) mileage=500; earn=mileage; } allmile+=earn; } return(0); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator