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

Re:一次AC

Posted by 785815369 at 2010-07-28 09:35:16 on Problem 1326
In Reply To:一次AC Posted by:785815369 at 2010-07-28 09:32:04
附上代码 简单处理输入 希望给有需要的点帮助

int main()
{
	string str;
	int num;
	char ch;
	cin>>str;
	while(1)
	{
		int sum=0;
		if(str=="#")break;
		if(str!="0")
		while(1)
		{
			if(str=="0")break;
			cin>>str>>num>>ch;
			if(ch=='F')sum+=num*2;
			else if(ch=='B')sum+=num+(int)(1.0*num/2+0.5);//四舍五入
			else if(ch=='Y')
			{
				if(num<500)sum+=500;
				else sum+=num;
			}
			cin>>str;
		}
		cout<<sum<<endl;
		cin>>str;
	}
}


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