hdu5365 Simple Geometry problem

Source: Internet
Author: User

http://acm.hdu.edu.cn/showproblem.php?pid=5365

Problem Descriptionafa is a girl who like runing. Today,he download an app about runing. The app can record the trace of her runing. AFA'll start runing in the park. There is many chairs in the Park,and AFA would start his runing in a chair and end in this chair. Between Chairs,she running in a line.she want the the trace can be a regular triangle or a square or a regular pentago N or a regular hexagon.
Many ways can her find.
Ways is same if the set of chair that they contains is same.
Inputthere is multiply case.
In each case,there are a integer n (1 < = n < =) in a line.
In next n lines,there is integers xi,yi (0 < = Xi,yi < 9) in each line.
Outputoutput the number of ways.
Sample Input
40 00 11) 01 1

Sample Output
1

/**hdu5365 simple geometry problem: Floret is a love fitness girl, this day she downloaded a running software, the software can record the track of Floret running.          Floret decided to go to the park to run. There were many seats in the park, and Floret wanted to take a break in some of the seats, and she only ran straight lines between the two seats. Floret is a perfectionist, she hopes her final trajectory is a three-sided or a positive quadrilateral or a positive pentagon or a positive hexagon. The little Flower begins to open the running software from a seat and closes after returning to the seat. May I ask how many kinds of flowers are running. Note: It is considered a kind of running method if the two types of seats are set in the same way.          And after a seat, there is no need to stop to solve the idea: the Earth people know that the whole point is not a positive Pentagon and positive three-sided and positive hexagon, so just a violent enumeration of four points to determine whether it is a positive quadrilateral. If you are not a man of the earth, then even if the violent enumeration is triangular and slightly less violent to find positive pentagon and hexagonal is also possible (anyway not found). */#include <stdio.h> #include <string.h> #include <algorithm> #include <iostream> #include < vector>using namespace std;struct note{int x, y;} A[105];int n;int len (int x,int y,int U,int v) {return (x-u) * (x-u) + (y-v) * (Y-V);}    int judge (int i,int j,int k,int L)///one-sided within a given four point coordinates to determine whether to form a square (find out the length of each side, sort, judge the relationship of the side) {vector <int> Vec;    Vec.push_back (Len (A[I].X,A[I].Y,A[J].X,A[J].Y));    Vec.push_back (Len (A[I].X,A[I].Y,A[K].X,A[K].Y));    Vec.push_back (Len (A[I].X,A[I].Y,A[L].X,A[L].Y));    Vec.push_back (Len (A[J].X,A[J].Y,A[K].X,A[K].Y)); Vec.push_back (Len (a[k].x,a[K].y,a[l].x,a[l].y)];    Vec.push_back (Len (A[L].X,A[L].Y,A[J].X,A[J].Y));    Sort (Vec.begin (), Vec.end ()); if (vec[0]==vec[1]&&vec[1]==vec[2]&&vec[2]==vec[3]&&vec[1]*2==vec[4]&&vec[4]==    VEC[5]) return true; return false;} int main () {while (~SCANF ("%d", &n)} {for (int i=0;i<n;i++) {scanf ("%d%d", &a[i].x        , &AMP;A[I].Y);        } int sum=0; for (int i=0;i<n;i++) {for (int. j=i+1;j<n;j++) {for (int k=j+1;k<n;k++ ) {for (int l=k+1;l<n;l++) {if (Judge (i,j,k                    , l)) sum++;    }}}} printf ("%d\n", sum); } return 0;}


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

hdu5365 Simple Geometry problem

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.