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

高手帮忙 关于1118 我的代码在自己的机器上能够通过(g++) 为什么提交老是失败:(

Posted by theant at 2007-05-18 23:16:48
#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
	int length = 0;
	cin>>length;
	double* point_x = new double[length];
	double* point_y = new double[length];
	double* end = new double[length];
	int x;
	int y;
	int k = 0;
	double temp = 0;
	int num = 1;
	cin>>x;
	while(x!=0)
	{
		cin>>y;
		*(point_x + k) = x;
		*(point_y + k) = y;
		k++;
		cin>>x;
	}
	for(int i = 0;i<length;i++)
	{
		for(int j = i+1;j<length;j++)
		{
			if(*(point_x+i)-*(point_x+j)==0)
			{
				*(end+j) = NULL;
			}else
			{
				
				*(end+j) = (*(point_y+i)- *(point_y+j)) / ((point_x+i)- (point_x+j));
			}
		}
		sort(end+i+1,end+length);
		temp = *(end+i+1);
		int temp_num = 2;
		for(int l = i+2;l<length;l++)
		{
			if(*(end+l)== temp)
			{
				temp_num++;
			}else
			{
				temp = *(end+l);

			}

		}
		if(temp_num>num)
		{
			num = temp_num;
		}
	}
	cout<<num<<endl;	
	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