Codeforces Gym 100342C problem C. Painting cottages violence

Source: Internet
Author: User
Tags integer numbers

Problem C. Painting Cottages
Time Limit:20 Sec

Memory limit:256 MB

Topic Connection

Http://codeforces.com/gym/100342/attachments

Description

The new cottage settlement is organized near the capital of Flatland. The construction company, is building the settlement have decided to paint some cottages pink and others-light blue. However, they cannot decide which cottages must be painted which color. The director of the company claims the painting are nice if there are at least one pink cottage, at least one light blu E Cottage, and it is possible to draw a straight line in such a-line that pink cottages was at one side of the line, and Li Ght Blue Cottages is at the other side of the line (and no cottage was on the line itself). The main architect objects that there is several possible nice paintings.
Help them to find out how many different nice paintings is there

Input

The first line of the input file contains n-the number of the cottages (1≤n≤300). The following n lines contain the coordinates of the Cottages-each line contains the integer numbers xi and Yi (−104≤x I, yi≤104).

Output

Output One integer number-the number of different nice paintings of the cottages.

Sample Input

4
0 0
1 0
1 1
0 1

Sample Output

12

HINT

Test instructions

Give you a two-dimensional diagram, then there are several points above, and then let you use a line to separate these points, ask you how many different ways to separate

The following:

Test instructions Transformation, is this n points, can even how many different line segments on the feeling is the check-in question ...

Data range only 300

Code:

//Qscqesze#include <cstdio>#include<cmath>#include<cstring>#include<ctime>#include<iostream>#include<algorithm>#include<Set>#include<vector>#include<sstream>#include<queue>#include<typeinfo>#include<fstream>#include<map>#include<stack>typedefLong Longll;using namespacestd;//freopen ("d.in", "R", stdin);//freopen ("D.out", "w", stdout);#defineSspeed ios_base::sync_with_stdio (0); Cin.tie (0)#defineMAXN 200001#defineMoD 10007#defineEPS 1e-9intNum;Charch[ -];//const int INF=0X7FFFFFFF; //нчоч╢сConst intinf=0x3f3f3f3f; inline ll read () {ll x=0, f=1;CharCh=GetChar ();  while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();}  while(ch>='0'&&ch<='9') {x=x*Ten+ch-'0'; ch=GetChar ();} returnx*F;}//**************************************************************************************structnode{Doublex, y;};intgcdintXinty) {    returny==0? X:GCD (y,x%y);} Map< pair<int,int>,int>H;node A[MAXN];intMain () {Freopen ("cottages.in","R", stdin); Freopen ("Cottages.out","W", stdout); intn=read ();  for(intI=0; i<n;i++) Cin>>a[i].x>>a[i].y; intans=0;  for(intI=0; i<n;i++) {h.clear ();  for(intj=i+1; j<n;j++)        {            intaa=a[i].x-a[j].x; intbb=a[i].y-a[j].y; intCc=gcd (AA,BB); if(H[make_pair (AA/CC,BB/CC)]==0) {ans++; H[make_pair (AA/CC,BB/CC)]=1; } }} cout<<ans*2<<Endl;}

Codeforces Gym 100342C problem C. Painting cottages violence

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.