记录编号 |
252507 |
评测结果 |
AAAAAAAAAA |
题目名称 |
数星星 |
最终得分 |
100 |
用户昵称 |
Sky_miner |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
3.163 s |
提交时间 |
2016-04-20 16:16:13 |
内存使用 |
4.19 MiB |
显示代码纯文本
#include<cstdio>
#include<cmath>
using namespace std;
struct Point{
int x,y;
Point(int a=0,int b=0): x(a),y(b){};
};
typedef Point Vector;
int operator * (const Vector &a,const Vector &b){
return a.x*b.x + a.y*b.y;
}
Vector operator + (const Vector &a,const Vector &b){
return Vector(a.x+b.x,a.y+b.y);
}
Vector operator - (const Vector &a,const Vector &b){
return Vector(a.x-b.x,a.y-b.y);
}
Vector operator / (const Vector &a,const int &b){
return Vector(a.x/b,a.y/b);
}
double Length(const Vector &a){
return sqrt(a*a);
}
int cross(const Vector &a,const Vector &b ){
return a.x*b.y - a.y*b.x ;
}
Point Get(const Point &a,const Vector &v,
const Point &b,const Vector &w){
Vector u = a - b;
double t = cross(w,u) / cross(v,w);
return a + v*t;
}
const int maxn = 1000 + 10 ;
Point p[maxn];
int f[maxn][maxn];
bool is(const Point &a,const Point &b,const Point &c){
return (b.y-a.y)*(c.x-a.x) == (c.y-a.y)*(b.x-a.x);
}
inline int cat_max(const int &a,const int &b){
return a>b? a:b;
}
int main(){
freopen("stars.in","r",stdin);
freopen("stars.out","w",stdout);
int n;scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d%d",&p[i].x,&p[i].y);
}
int ans = 0;
for(int i=1;i<=n;i++)
for(int j=1;j<i;j++){
// f[i][j] = 1;
for(int k=1;k<j;k++){
if( f[i][j] < f[j][k] + 1 && is(p[i],p[j],p[k]) ){
f[i][j] = f[j][k] + 1;
}
}
ans = cat_max(ans,f[i][j]);
}
printf("%d",ans+2);
}