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

终于AC了30个题 纪念一下...... 继续加油 附代码

Posted by io07 at 2014-03-16 01:14:18 on Problem 2606 and last updated at 2014-03-16 01:16:45
和1118是一样的,直接copy过来了
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <assert.h>

using namespace std;
#define SIZE 1000
int main()
{
    int Psum[SIZE][2];
    int N,Max;
    scanf("%d",&N);
    Max=0;
    for(int i=0;i<N; i++){
        scanf("%d%d",&Psum[i][0],&Psum[i][1]);
    }
    //枚举的时候应该注意 先确定两个点 从而确定一条直线 再判断第三个点是否在这条直线上
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            int sum=0;
            for(int k=j+1; k<N; k++)
                if((Psum[i][0]-Psum[j][0])*(Psum[i][1]-Psum[k][1]) == (Psum[i][0]-Psum[k][0])*(Psum[i][1]-Psum[j][1]))  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