| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
高手帮忙 关于1118 我的代码在自己的机器上能够通过(g++) 为什么提交老是失败:(#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator