| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:共线~~ 水过..In Reply To:共线~~ 水过.. Posted by:bhbwudia at 2012-11-07 02:23:51 > #include <iostream>
> #include <cmath>
> #include <cstdio>
> #include <algorithm>
> using namespace std;
> const int MAXN = 700;
> struct Point
> {
> int x,y;
> }Psum[MAXN];
> int main()
> {
> int N;
> int sum,Max;
> while(scanf("%d",&N)!=EOF&&N )
> {
> Max=0;
> for(int i=0; i<N; i++)
> {
> scanf("%d %d",&Psum[i].x,&Psum[i].y);
> }
> for(int i=0; i<N; i++)
> {
> for(int j=i+1; j<N; j++)
> {
> sum=0;
> for(int k=j+1; k<N; k++)
> {
> if((Psum[i].x-Psum[j].x)*(Psum[i].y-Psum[k].y) == (Psum[i].x-Psum[k].x)*(Psum[i].y-Psum[j].y))
> sum++;
> }
> if(Max<sum)
> Max=sum;
> }
> }
> printf("%d\n",Max+2);
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator