Skip to content

Instantly share code, notes, and snippets.

@latte0119
Created August 17, 2016 18:37
Show Gist options
  • Save latte0119/34585c3bcce76f16778e4ef92278ab5f to your computer and use it in GitHub Desktop.
Save latte0119/34585c3bcce76f16778e4ef92278ab5f to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
const double PI=acos(-1);
const double EPS=1e-6;
int N;
double x[333],y[333];
signed main(){
while(cin>>N,N){
rep(i,N)cin>>x[i]>>y[i];
int ma=1;
rep(i,N)rep(j,N){
if(i==j)continue;
double dx=x[i]-x[j],dy=y[i]-y[j];
double d=sqrt(dx*dx+dy*dy);
if(d>2+EPS)continue;
double r=sqrt(1.0-d*d/4);
double vx=-dy/d*r;
double vy=dx/d*r;
double xx=(x[i]+x[j])/2+vx;
double yy=(y[i]+y[j])/2+vy;
int cnt=0;
rep(k,N){
if((x[k]-xx)*(x[k]-xx)+(y[k]-yy)*(y[k]-yy)<1.0+EPS)cnt++;
}
chmax(ma,cnt);
}
printf("%lld\n",ma);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment