HDU 5365 Judging Square

Source: Internet
Author: User

Test instructions: gives n points (coordinates are integers), judging how many positive triangles, positive quads, positive Pentagon, positive hexagons can be formed.

The official puzzle: the Earth people know that the whole point is not a positive pentagon and positive triangular shape and positive hexagonal, 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).

...... It seems that I am not the earth person ...

As for judging the square, just judge the four sides equal and a diagonal is the side length of the root of the root twice times on the line.

1#include <iostream>2#include <cstring>3#include <cstdio>4 using namespacestd;5 6 Const intN = -;7 8 struct Point9 {Ten     intx, y; One } Point[n]; A  - intSquareintx) - { the     returnX *x; - } -  - intDis2 (intAintb) + { -     returnSquare (point[a].x-point[b].x) + Square (POINT[A].Y-point[b].y); + } A  at intJudgeintAintBintCintd) - { -     intDD =Dis2 (A, c); -     if(Dis2 (A, b) *2= = DD && Dis2 (b, c) *2==DD -&& Dis2 (c, D) *2= = DD && Dis2 (d, a) *2= = dd)return 1; -     return 0; in } -  to intMain () + { -     intN; the      while(SCANF ("%d", &n)! =EOF) *     { $          for(inti =0; I < n; i++ )Panax Notoginseng         { -scanf"%d%d", &point[i].x, &point[i].y); the         } +         intAns =0; A          for(inti =0; I < n; i++ ) the         { +              for(intj =0; J < N; J + + ) -             { $                 if(i = = j)Continue; $                  for(intK =0; K < n; k++ ) -                 { -                     if(i = = k | | j = = k)Continue; the                      for(intL =0; l < N; l++ ) -                     {Wuyi                         if(i = = L | | j = = L | | k = = l)Continue; theAns + =judge (I, J, K, l); -                     } Wu                 } -             } About         } $Ans >>=3; -printf"%d\n", ans); -     } -     return 0; A}

HDU 5365 Judging Square

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.