这题数据比较小,所以直接当做一个数学题就行了,主要就是输入的问题,因为输入的问题RE了好几遍,最后看到
别人用的sscanf,改了就过了。
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string>
#include<set>
#include<map>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define LL long long
using namespace std;
const int maxn=1000;
const int mod=1e9+7;
int a[maxn],b[maxn];
int n;
int main()
{
int t;
cin>>t;
getchar();
getchar();
while(t--)
{
int n=0;
char str[1000];
while(gets(str))
{
if(!str[0]) break;
sscanf(str,"%d%d",&a[n],&b[n]);
n++;
}
int ans=2;
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
int t1=a[j]-a[i];
int t2=b[j]-b[i];
int tem=2;
for(int k=0;k!=i&&k!=j&&k<n;k++)
{
if((b[k]-b[i])*t1==(a[k]-a[i])*t2)
tem++;
}
if(tem>ans)
ans=tem;
}
}
cout<<ans<<endl;
if(t)
cout<<endl;
}
return 0;
}