比赛 “Asm.Def战记之拉格朗日点”杯 评测结果 AWWWWWWWWW
题目名称 Asm.Def找燃料 最终得分 10
用户昵称 AISS 运行时间 1.099 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2015-11-04 10:45:06
显示代码纯文本
#include<cstdio>
#include<set> 
#include<vector> 
#include<map> 
#include<iostream> 
#include<algorithm> 
#include<cmath> 
#include<queue> 
#define maxn 100000000
#define N 10007
using namespace std;
int i,j,m,n,k,a,b,mx;
double x[105],y[105];

int main(){
//	freopen("0.txt","r",stdin);
//	freopen("1.txt","w",stdout);
	freopen("asm_fuel.in","r",stdin);
	freopen("asm_fuel.out","w",stdout);
	cin>>n;
	for(i=0;i<n;i++)scanf("%d%d",&x[i],&y[i]);
	for(i=0;i<n;i++)
		for(j=i+1;j<n;j++){
			int cnt=2;
			if(x[j]!=x[i]){
				double k1=(y[j]-y[i])/(x[j]-x[i]);
			//	cout<<y[j]-y[i]<<" "<<x[j]-x[i]<<endl;
				//cout<<"x1="<<x[i]<<" "<<"y1="<<y[i]<<" "<<"x2="<<x[j]<<" "<<"y2="<<y[j]<<" "<<"k="<<k1<<"----"<<endl;
				for(k=0;k<n;k++){
					if(k!=i&&k!=j&&x[k]!=x[j]){
						double k2=(y[k]-y[j])/(x[k]-x[j]),o=k1-k2;
						if(o>=-1e-6&&o<=1e-6)cnt++;	//cout<<"x3="<<x[k]<<" "<<"y3="<<y[k]<<" "<<"k="<<k2<<endl,cout<<"cnt="<<cnt<<endl;
					}
				}
			}
			else for(k=0;k<n;k++) if(k!=i&&k!=j)
				if(x[k]==x[j])cnt++;	
			mx=max(cnt,mx);
		}
	cout<<mx<<endl;
	return 0;
}