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

晕!int AC double WA why?!

Posted by zhangfeifei at 2010-06-11 12:01:34 on Problem 1326
#include "stdio.h"
#include "string.h"
#include "math.h"

double bonus(double real,char * str){
	if(!strcmp(str,"F")){
		return 2*real;
	}else if(!strcmp(str,"B")){
		return 1.5*real-(int)(1.5*real)>0.1 ? (int)(1.5*real+1) : (int)(1.5*real);
	}else{
		if(real >= 500){
			return real;
		}
		return 500.0;
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
#endif

	char str1[100],str2[100],cla[2];
	double x;
	while(scanf("%s%s%lf%s",str1,str2,&x,cla), strcmp(str1,"#")){
		double sum = 0;
		sum += bonus(x,cla);
		while(scanf("%s",str1)){
			if(!strcmp(str1,"0")){
				printf("%.0lf\n",sum);
				break;
			}
			scanf("%s%lf%s",str2,&x,cla);
			sum += bonus(x,cla);
		}
	}
}

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