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我的程序没有这个问题,不过也wa,高手帮我看看,谢谢

Posted by ljl08 at 2007-08-01 21:55:31 on Problem 1326
In Reply To:提交了20多次再加上和同学AC的代码比较终于知道陷阱在哪儿了.估计WA的都是这样. Posted by:tq at 2005-08-02 18:39:51
#include <string>
#include <stdio.h>
void main(){
	char city[100];
	char code;
	int m;
	float dis; 
	while(1){
		m=0;
		while(1){
			scanf("%s",&city);
			if(strcmp(city,"0")==0||strcmp(city,"#")==0)break;
			scanf("%s",&city);
			scanf("%f",&dis);
			scanf("%c",&code);
			scanf("%c",&code);
			switch(code){
			case 'F':
				m+=int(dis*2);
				break;
			case 'B':
				m+=int(dis*1.5+0.5);
				break;
			case 'Y':
				if(dis<500)m+=500;
				else m+=dis;
				break;
			}
			
		}
		printf("%d\n",m);
		if(strcmp(city,"#")==0)
			break;
		else continue;
	}
}


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