Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

共线~~ 水过..

Posted by bhbwudia at 2012-11-07 02:23:51 on Problem 1118
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator