日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

(四面体)CCPC网络赛 HDU5839 Special Tetrahedron

發布時間:2023/11/29 编程问答 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 (四面体)CCPC网络赛 HDU5839 Special Tetrahedron 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 CCPC網絡賽 HDU5839 Special Tetrahedron 2 題意:n個點,選四個出來組成四面體,要符合四面體至少四條邊相等,若四條邊相等則剩下兩條邊不相鄰,求個數 3 思路:枚舉四面體上一條線,再找到該線兩個端點相等的點,放在一個集合里面。 4 要符合條件的話,則該集合里面找兩個點,并且要判斷一下。 5 注意,普通四面體會被重復計算兩次,正四面體會重復計算六次 6 7 8 #include <bits/stdc++.h> 9 using namespace std; 10 #define LL long long 11 const double inf = 123456789012345.0; 12 const LL MOD =100000000LL; 13 const int N =210; 14 #define clc(a,b) memset(a,b,sizeof(a)) 15 const double eps = 1e-7; 16 void fre() {freopen("in.txt","r",stdin);} 17 void freout() {freopen("out.txt","w",stdout);} 18 inline int read() {int x=0,f=1;char ch=getchar();while(ch>'9'||ch<'0') {if(ch=='-') f=-1; ch=getchar();}while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}return x*f;} 19 20 struct Point { 21 double x,y,z; 22 Point() {} 23 Point(LL _x,LL _y,LL _z):x(_x),y(_y),z(_z) {} 24 Point operator + (const Point &t) const { 25 return Point(x+t.x,y+t.y,z+t.z); 26 } 27 Point operator -(const Point &t) const { 28 return Point(x-t.x,y-t.y,z-t.z); 29 } 30 Point operator *(const Point &t) const { 31 return Point(y*t.z-z*t.y,z*t.x-x*t.z,x*t.y-y*t.x); 32 } 33 double operator ^(const Point &t) const { 34 return x*t.x+y*t.y+z*t.z; 35 } 36 double len2(){ 37 return x*x+y*y+z*z; 38 } 39 } p[N]; 40 41 bool check(Point a,Point b,Point c,Point d) { 42 return (((a-b)*(a-c))^(a-d))==0.0; 43 } 44 45 int l[210]; 46 int main() { 47 int T; 48 scanf("%d",&T); 49 for(int cas=1; cas<=T; cas++) { 50 int n,cnt; 51 int ans=0,tem=0; 52 scanf("%d",&n); 53 for(int i=1; i<=n; i++) scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].z); 54 for(int i=1; i<n; i++) { 55 for(int j=i+1; j<=n; j++) { 56 cnt=0; 57 for(int k=1; k<=n; k++) { 58 if(k==i||k==j) continue; 59 Point p1,p2; 60 p1=p[k]-p[i]; 61 p2=p[k]-p[j]; 62 if(p1.len2()==p2.len2()) { 63 l[cnt++]=k; 64 } 65 } 66 for(int k=0; k<cnt-1; k++) { 67 for(int h=k+1; h<cnt; h++) { 68 Point p1=p[l[h]]-p[i],p2=p[l[k]]-p[i]; 69 if(p1.len2()!=p2.len2()) continue; 70 if(check(p[i],p[j],p[l[k]],p[l[h]])) continue; 71 ans++; 72 Point p3=p[l[k]]-p[l[h]]; 73 Point p4=p[i]-p[j]; 74 if(p1.len2()==p3.len2()&&p4.len2()==p3.len2()) 75 tem++; 76 } 77 } 78 } 79 } 80 ans/=2; 81 ans=ans-2*tem/6; 82 printf("Case #%d: ",cas); 83 printf("%d\n",ans); 84 } 85 return 0; 86 }

?

轉載于:https://www.cnblogs.com/ITUPC/p/5772975.html

總結

以上是生活随笔為你收集整理的(四面体)CCPC网络赛 HDU5839 Special Tetrahedron的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。