Hdu5305run (square decision)

Source: Internet
Author: User

Hint: water problem, mainly understand the condition of square judgment, this point if confused there will be a lot of missing places

The judging condition of the square is: 4 sides of equal length, two diagonal lines equal

For this, the general method is to find the distance between the 6 22 vertices, and then determine whether each is equal

Runaccepts:126submissions:558Time limit:2000/1000 MS (java/others)Memory limit:65536/65536 K (java/others)Problem description
Floret is a love of fitness girl, this day she downloaded a running software, the software can record the trail 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 there's no need to stop when you pass a seat.
Enter a description
Enter multiple sets of data per set of data first behavior one n (1 < = n < = 20) indicates the number of seats next n rows, two integers per line xi,yi (0 < = Xi,yi < = 8) represents the coordinates of the seat
Output description
Number of output scenarios
Input sample
40 00 11) 01 1
Output sample
1

1#include <cstdio>2#include <map>3#include <queue>4#include <stack>5#include <vector>6#include <algorithm>7#include <cstring>8#include <cmath>9#include <iostream>Ten#include <Set> One#include <stdlib.h> A using namespacestd; - structnode{ -     intx; the     inty; -}a[ -]; - intDisintX1,intY1,intX2,inty2) - { +     return((X1-X2) * (X1-X2) + (y1-y2) * (y1-y2)); - } + intMain () A { at     intN; -      while(cin>>N) -     { -          for(intI=0; i<n;i++) -         { -Cin>>a[i].x>>a[i].y; in         } -         intsum=0; to          for(intI=0; i<n-3; i++) +         { -              for(intj=i+1; j<n-2; j + +) the             { *                  for(intp=j+1;p <n-1;p + +) $                 {Panax Notoginseng                      for(intq=p+1; q<n;q++) -                     { the                         intb[6]; +                         intt=0; Ab[t++]=dis (a[i].x,a[i].y,a[j].x,a[j].y); theb[t++]=dis (a[i].x,a[i].y,a[p].x,a[p].y); +b[t++]=dis (a[i].x,a[i].y,a[q].x,a[q].y); -b[t++]=dis (a[p].x,a[p].y,a[j].x,a[j].y); $b[t++]=dis (a[q].x,a[q].y,a[j].x,a[j].y); $b[t++]=dis (a[p].x,a[p].y,a[q].x,a[q].y); -Sort (b,b+t); - //                        //for (int k=0;k<t;k++) the //                        { - //cout<<b[k]<< "";Wuyi //                        } the                         if(b[0]==b[1]&&b[1]==b[2]&&b[2]==b[3]&&b[5]==b[4]) -                         { Wusum++; -                         } About                     } $                 } -             } -              -         } Acout<<sum<<Endl; +     } the     return 0; -}
View Code

Hdu5305run (square decision)

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.