CCPC the eighth question, the number of three-dimensional geometry, the problem is described in comments
Three dimensional geometry-to meet the requirements of the number of tetrahedron//requirements 1: At least 4 edges equal//required 2: Four edges equal, the other two edges must not be adjacent (that is, opposite side)//solving: With the current edge is not adjacent to one of the side, to the 3rd that can constitute Isosceles triangle enumeration// Again to these 3rd collection do a n^2 enumeration, in two cases to find the tetrahedron//if the four or five edges are the same, there are only two repetition (current and Edge interchange)//If the six edges are the same, there are six repetition cases (each side as the current edge)//time :499msmemory:1576k#include<iostream> #include <cstring> #include <cstdio>using namespace std;# Define MAXP 205#define POW (x) ((x) * (x)) struct point{int x, y, Z; Point () {}point (int xx, int yy, int zz): x (xx), Y (yy), Z (ZZ) {}}p[maxp];struct Node {int d, u; Node () {}node (int dd, int uu):D (DD), U (UU) {}}nd[maxp];int n;int len;int Distance (Point A, point B) {return POW (a.x-b.x) + Pow (A.Y-B.Y) + POW (a.z-b.z);} Point Xmult (Point A, point B)/cross product {return point (A.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x);} Vector difference-A (b to a) point subt (Point A, point B) {return point (a.x-b.x, A.y-b.y, a.z-b.z);} int Dmult (point A, points B)//dot product {return a.x*b.x + a.y*b.y + a.z*b.z;} Take the planar normal vector point Normalv (Point A, point B, point C) {return Xmult (Subt (A, B), subt (b, C));} BOOL Onplane (Point A, point B, Point C, point D)//Four points coplanar {return Dmult (Normalv (A, B, c), Subt (d, a)) = = 0;} int main () {//freopen ("t.in", "R", stdin), int t;int cas = 1;scanf ("%d", &t), while (t--) {scanf ("%d", &n); for (int i = 0; I < n; i++) scanf ("%d%d%d", &p[i].x, &p[i].y, &p[i].z); int sum1 = 0, sum2 = 0;//sum1: Six edges are not equal, sum2: Six edges are equal for (int i = 0 ; I < n; i++) {for (int j = i + 1; j < N; j + +) {len = 0;for (int k = 0; k < n; k++)//enumeration to the 3rd K{if of the same distance on the IJ segment (k = = I | | k = = j) Co Ntinue;int tmp = Distance (P[i], p[k]), if (tmp = = Distance (P[j], p[k])) nd[len++] = Node (tmp, k);} for (int k1 = 0; K1 < len, k1++) {for (int k2 = k1 + 1; K2 < Len; k2++) {if (nd[k1].d! = nd[k2].d) continue;if (Onplan E (P[i], p[j], p[nd[k1].u], p[nd[k2].u])) continue;int tmp = Distance (p[nd[k1].u], p[nd[k2].u]); if (tmp = = Distance (P[i], p [j]) && tmp = = nd[k1].d) sum2++;//Six edges equal else sum1++;}}} printf ("Case #%d:%d\n", cas++, SUM1/2+SUM2/6);} return 0;}
ACM/ICPC's three-dimensional computational geometry + brute Force enumeration + weight (HDU5839)