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

52题留念!付水代码!

Posted by woshiliyiyiyiyi at 2012-06-21 00:06:31 on Problem 2606
#include<iostream>

using namespace std;
#define N 702

class test
{
private:
	int xi[N], yi[N];
	int number;
public:
	void set(int n);
	int each(int i, int j, int k);
	void fun();
};

void test::set(int n)
{
	int i;
	
	number = n;
	for (i=0; i<number; i++)
	{
		cin >> xi[i] >> yi[i];
	}
}

int test::each(int i, int j, int k)
{
	int a1, b1;
	int a2, b2;
	
	a1 = xi[j] - xi[i]; b1 = yi[j] - yi[i];
	a2 = xi[k] - xi[i]; b2 = yi[k] - yi[i];
	
	return (a1 * b2) - (a2 * b1);
}

void test::fun()
{
	int i, j, k;
	int pointNumber;
	int Rpoint;
	
	pointNumber = 2;
	for (i=0; i<number-2; i++)
	{
		for (j=i+1; j<number; j++)
		{
			Rpoint = 2;	
			for (k=j+1; k<number; k++)
			{
				if (!each(i, j, k))
					Rpoint++;
			}
			if (Rpoint > pointNumber)
			{
				pointNumber = Rpoint;
			}
		}
	}
	cout << pointNumber << endl;
}

int main()
{
	int count;
	test Point;
	
	cin >> count;
	Point.set(count);
	Point.fun();
	
	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