4337235   2006-02-15 07:40:14  Accepted 5.076 456 28565 C++ 10167 - Birthday Cake 
~cpp
#include <iostream>
#include <vector>
using namespace std;
struct point
{
	int x;
	int y;
};
vector<point> test;
void process()
{
	bool check = false;
	int i, j, k, ceil, floor, temp;
	for(i = -500; i <= 500; i++)
	{
		for(j = -500; j <= 500; j++)
		{
			ceil = floor = 0;
			for(k =0; k < test.size(); k++)
			{
				temp = i*test[k].x + j*test[k].y;
				if(temp == 0)
					break;
				else if(temp > 0)
					ceil++;
				else if(temp < 0)
					floor++;
			}
			if(k == test.size())
			{
				if(ceil == floor && ceil + floor == test.size())
				{
					cout << i << " " << j << endl;
					return;
				}
			}
		}
	}
}
int main()
{
	int Num,i;
	point temp;
	cin >> Num;
	while(Num != 0)
	{
		for(i = 0; i < 2*Num; i++)
		{
			cin >> temp.x >> temp.y;
			test.push_back(temp);
		}
		process();
		test.clear();
		cin >> Num;
	}
	return 0;
}










