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