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 200831000423 at 2010-04-29 19:33:21 on Problem 1118
#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;

const int LEN = 700;
int x[LEN], y[LEN];

void solve(int n) {
    int max(0), temp_max(0);
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            temp_max = 0;
            for (int k = j + 1; k < n; ++k) {
                if ((x[k] - x[i])*(y[j] - y[i]) == (x[j] - x[i])*(y[k] - y[i]))
                    ++temp_max;
            }
            max = max > temp_max ? max : temp_max;
        }
    }
    cout << max + 2 << endl;
}

int main() {
    int cases;
    while (scanf("%d", &cases) && cases) {
        for (int i = 0; i < cases; ++i)
            scanf("%d%d", x + i, y + i);
        solve(cases);
    }
    return EXIT_SUCCESS;
}



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