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

这是我的代码,哪里有问题,谢谢?

Posted by EndlessHorizon at 2005-03-15 17:41:43 on Problem 1326
#include <iostream.h>
#include <ctype.h>
#include <math.h>

void main()
{
	char ch;
	double sum=0,cur;
	int ans;
	while(cin.peek()!='#')
	{
		while(cin.peek()!='0')
		{
			while(!isdigit(cin.peek()))
				cin.get(ch);
			cin>>cur>>ch;
			if(cur>=0)
			{
				switch (ch)
				{
				case 'F': sum+=cur*2;break;
				case 'B': sum+=ceil(cur*1.5);break;
				case 'Y': sum+=cur>500?cur:500;
				}
			}
			cin.ignore();
		}
		ans=(int)ceil(sum);
		cout<<ans<<endl;
		cin.ignore(2);
	}
}


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