显示代码纯文本
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define def //
using namespace std;
int x[110],y[110];
bool vis[110][110][110];
int main()
{
freopen("asm_fuel.in","r",stdin);
freopen("asm_fuel.out","w",stdout);
int n,i,j,k,kx,ky,tmpx,tmpy,sx,sy,total=1,ans=-1;
scanf("%d",&n);
bool b=0;
for(i=1;i<=n;i++)
{
scanf("%d%d",&x[i],&y[i]);
if(i>1 && (x[i]!=x[i-1] || y[i]!=y[i-1]))
b=1;
}
if(!b){printf("%d",n);return 0;}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
total=0;
if(x[i]==x[j] && y[j]==y[i])
continue;
if(x[i]==x[j])
{
for(k=j+1;k<=n;k++)
if(x[k]==x[i])
total++;
ans=max(total,ans);
continue;
}
kx=x[i]-x[j];
ky=y[i]-y[j];
for(k=1;k<=n;k++)
{
if(x[k]==x[i] && y[k]==y[i])
total++;
else if(x[k]==x[j] && y[k]==y[j])
total++;
else if(x[k]==x[i]) continue;
else
{
tmpx=x[k]-x[i];
tmpy=y[k]-y[i];
if(tmpx*ky == tmpy*kx)
total++;
}
}
ans=max(total,ans);
}
printf("%d",ans);
}