记录编号 204507 评测结果 AAAAAAAAAA
题目名称 [SYOI 2015] Asm.Def找燃料 最终得分 100
用户昵称 GravatarCollor 是否通过 通过
代码语言 C++ 运行时间 0.011 s
提交时间 2015-11-04 13:21:36 内存使用 0.31 MiB
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<ctime>
using namespace std;
const int maxn=105;
struct node
{
	int x,y,v;
}a[maxn];
int n,f[maxn];
inline double Abs(double t){
	if (t<0)return -t;
	return t;
}
void init()
{
	memset(a,0,sizeof(a));
	cin>>n;
	int k=0;
	int xx,yy;
	for (int i=1;i<=n;) {
		
		scanf("%d%d",&xx,&yy);
		for (int j=1;j<i;j++) {
			if (a[j].x==xx&&a[j].y==yy){
				a[j].v++;

				goto Tail;
			}
		}
		a[++k].x=xx;
		a[k].y=yy;
		a[k].v++;
		Tail:
		i++;
	}
	n=k;
}
int main()
{
	freopen("asm_fuel.in","r",stdin);
	freopen("asm_fuel.out","w",stdout);
	//double t1 = (double)clock()/(double)CLOCKS_PER_SEC;
	
	init();
	
	int p;
	double p1,p2;
	//bool f1=0,f2=0;
	int sum=0,maxx=0;
	for (int i=1;i<n-1;i++){
		for (int j=i+1;j<n;j++) {
			sum = a[i].v+a[j].v;
			p=a[j].x-a[i].x;
			if (!p){
				for (int k=j+1;k<=n;k++)
					if (a[k].x==a[j].x)sum+=a[k].v;
				if (sum>maxx)maxx=sum;
				continue ; 
			}
			if (!(a[j].y-a[i].y)) {
				for (int k=j+1;k<=n;k++)
					if (a[k].y==a[j].y)sum+=a[k].v;
				if (sum>maxx)maxx=sum;
				continue ;
			}
			p1=((a[j].y-a[i].y)*1.00000)/p;
			
			for (int k=j+1;k<=n;k++) {
				p2=((a[k].y-a[i].y)*1.00000/(a[k].x-a[i].x));
				if (Abs(p2-p1)<0.00001)sum+=a[k].v;
			}
			if (sum>maxx)maxx=sum;
		}
		
	}
	//double t2 = (double)clock()/(double)CLOCKS_PER_SEC;
	//printf("%lf\n",t2-t1);
	printf("%d\n",maxx);
	return 0;
}