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 neverend at 2007-08-02 16:41:20 on Problem 1326
#include"iostream"
using namespace std;
struct race
{
	char name[50],c;
	__int64 dist;
};
int main()
{
	struct race a[100];
	int i=0,flag=1,sum;
	while(flag)
	{
		sum=0;
		while(1)
		{
			scanf("%s",a[i].name);
			if('a[i].name[0]'=='#')
				break;
			else if('a[i].name[0]'!='0')
			{
				{
				scanf("%I64d",&a[i].dist);
				scanf("%c",&a[i].c);
			
				}
				switch(a[i].c)
				{
				case 'F':sum+=2*a[i].dist;break;
				case 'B':sum+=a[i].dist+0.5*(a[i].dist+1);break;
				case 'Y':
					if(a[i].dist<=500)
						sum+=500;
					else
						sum+=a[i].dist;
					break;
				default:break;
				}
				i++;
			}
			else if('a[i].name[0]'=='0')
				break;
		}
		if('a[i-1].name[0]'=='#')
			break;
		else if('a[i-1].name[0]'=='0')
		{
			printf("%I64d\n",sum);
			flag=0;
		}
	}
	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