比赛 20161114 评测结果 EEEEEEEEEE
题目名称 输出全靠花 最终得分 0
用户昵称 coolkid 运行时间 0.756 s
代码语言 C++ 内存使用 0.33 MiB
提交时间 2016-11-14 11:43:40
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

const int MAXN=1e3+10;

int n;
int X[MAXN],Y[MAXN],Z[MAXN],W[MAXN];

void init(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d%d%d",&X[i],&Y[i],&Z[i],&W[i]);
}

const int EPS=1e-6;

inline bool feq(double a,double b){
	return fabs(a-b)<=EPS;
}

int ans=0;
void work(){
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			int temp=0;
			for(int k=1;k<=n;k++) if(k!=i&&k!=j){
				if(X[i]!=X[j]){
					double l=(X[k]-X[i])/(X[j]-X[i]);
					if(feq(l,(Y[k]-Y[i])/(Y[j]-Y[i]))&&feq(l,(Z[k]-Z[i])/(Z[j]-Z[i]))&&feq(l,(W[k]-W[i])/(W[j]-W[i]))) temp++;
				}
				else if(Y[i]!=Y[j]){
					if(X[i]!=X[k]) continue;
					double l=(Y[k]-Y[i])/(Y[j]-Y[i]);
					if(feq(l,(Z[k]-Z[i])/(Z[j]-Z[i]))&&feq(l,(W[k]-W[i])/(W[j]-W[i]))) temp++;
				}
				else if(Z[i]!=Z[j]){
					if(X[i]!=X[k]||Y[i]!=Y[k]) continue;
					double l=(Z[k]-Z[i])/(Z[j]-Z[i]);
					if(feq(l,(W[k]-W[i])/(W[j]-W[i]))) temp++;
				}
				else{
					if(X[i]!=X[k]||Y[i]!=Y[k]||Z[i]!=Z[k]) continue;
					temp++;
				}
			}
			ans=max(ans,temp+2);
		}
	printf("%d\n",ans);
}

int main(){
	freopen("xumingshi.in","r",stdin);
	freopen("xumingshi.out","w",stdout);
	init();
	work();
	return 0;
}