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 tq at 2005-07-14 20:00:55 on Problem 1326
In Reply To:我也是~数据有问题吧~~~ Posted by:tq at 2005-07-14 20:00:15
#include <stdio.h>
#include <string.h>
#include <math.h>

main()
{
	char s1[300],s2[300];
	double mile;
	char type[5];
	double tot;
	

	scanf("%s", s1);
	while (s1[0]!='#' )
	{
		tot=0;
		while (s1[0]!='0')
		{
			scanf("%s",s2);
			scanf("%lf", &mile);
			scanf("%s", type);
			if (type[0]=='F')
			{
				tot+=2*mile;
			}
			else if (type[0]=='B')
			{
				tot+=1.5*mile;
			}
			else if (type[0]=='Y')
			{
				if (mile<500)
				{
					tot+=500;
				}
				else
				{
					tot+=mile;

				}
			}
			scanf("%s", s1);
		}
		printf("%.0lf\n",tot);
		scanf("%s", s1);
	}


	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