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

标准答案。OK.免费奉送

Posted by drownever at 2006-12-26 21:35:26 on Problem 2272
#include<iostream.h>
#include<math.h>
float value(float a,float b);
int main()
{
	float a,b;
	while(1)
	{
		float result[2];
		result[0]=0;result[1]=0;//init 
		for(int i=0;i<2;i++)
			for(int j=0;j<3;j++)
			{
				cin>>a>>b;
				if(a==-100)return 0;
				result[i]+=value(a,b);
			}
        if(result[0]==result[1])
			cout<<"SCORE: "<<result[0]<<" to "<<result[1]<<", TIE."<<endl;
			else 
				if(result[0]>result[1])
					cout<<"SCORE: "<<result[0]<<" to "<<result[1]<<", PLAYER 1 WINS."<<endl;
				else
					cout<<"SCORE: "<<result[0]<<" to "<<result[1]<<", PLAYER 2 WINS."<<endl;
         
	}
	return 0;
}

float value(float a,float b)
{
	a=sqrt(a*a+b*b);
	if(a<=3)return 100;
	else
		if(a<=6)return 80;
		else
			if(a<=9)return 60;
			else
				if(a<=12)return 40;
				else
					if(a<=15)return 20;
					else
						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