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:提交了20多次再加上和同学AC的代码比较终于知道陷阱在哪儿了.估计WA的都是这样.

Posted by ecjtuQX at 2008-08-01 09:02:26 on Problem 1326
In Reply To:提交了20多次再加上和同学AC的代码比较终于知道陷阱在哪儿了.估计WA的都是这样. Posted by:tq at 2005-08-02 18:39:51
发个代码告诉啊!
让POJ不要再害人了啊!
#include<stdio.h>
#include<string.h>
int main()
{
	char s1[100],s2[100],s3[10];
	int sum,n;
	while(1)
	{   
		sum=0;
		while(1)
		{
			scanf("%s",s1);
			if(strcmp(s1,"#")==0)
				goto loop;
			if(strcmp(s1,"0")==0)
			             break;
			scanf("%s %d %s",s2,&n,s3);
			if(strcmp(s3,"Y")==0)
			{ 
				if(n<=500)
			     sum+=500;
				else
				  sum+=n;
			}
			else if(strcmp(s3,"B")==0)
			sum+=n+(n+1)/2;//等价于sum+=1.5*n;
			else if(strcmp(s3,"F")==0)
			sum+=2*n;
		}
		printf("%d\n",sum);
		sum=0;
	}
loop:;
	 return 0;
}
     

/*
Sample Input

Beijing Tokyo 1329 F
Shanghai Wuhan 433 Y
0
#

Sample Output

3158
*/

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