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

hhh<set>大法

Posted by liu_cheng_ao at 2016-09-14 17:50:45 on Problem 3668
#include<cstdio>
#include<cstdlib>
#include<set>

using namespace std;

int n,x[300],y[300];
set<double>ks;

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    scanf("%d%d",&x[i],&y[i]);
    for(int i=1;i<n;i++)
    for(int j=i+1;j<=n;j++)
    {
            double k;
            if(x[i]==x[j])k=999999999.0;
            else k=(double)(y[i]-y[j])/(x[i]-x[j]);
            ks.insert(k);
    }
    printf("%d",ks.size());
    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