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 chenxuan123456789 at 2012-07-29 16:50:37 on Problem 1326
#include <stdio.h>
#include <string.h>
int main()
{
	int total,distance,flag;
	char start[100],dest[100],style;
	while(1)
	{
		    flag=0;
			total=0;
			while(1)
			{
			 scanf("%s",start);
			if(!strcmp(start,"0"))
			break;
			if(!strcmp(start,"#"))
			{
				flag=1;
				break;
			}
			scanf("%s %d %c",dest,&distance,&style);
			switch(style)
			{
			case'F':
				{
					total+=2*distance;
					break;
				}
			case'B':
				{
					if(distance%2)
						total+=distance+distance/2+1;
					else
					    total+=distance+distance/2;
					break;
				}
			case'Y':
				{
					if(distance<=500)
						total+=500;
					else
						total+=distance;
					break;
				}
			}
		}
		printf("%d\n",total);
		if(flag)
		break;
	}
		return 1;
}


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