Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贴个AC的代码

Posted by et1239063237 at 2012-08-08 13:32:51 on Problem 1326
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator