这题无数据

P2287 [HNOI2004] 最佳包裹

无数据又怎样,无数据的题多着呢=.=
by codesonic @ 2017-08-06 15:08:16


(话说又无数据qwq) (而且at的机制真是玄学,一直学不会qwq)
by beng @ 2017-08-06 15:09:03


@[CREEPER\_](/space/show?uid=45443) 但对于有需求的人来说不是不好吗?
by beng @ 2017-08-06 15:10:20


收到,正在生成数据 另推荐各位使用cyaron
by icy @ 2017-08-06 19:15:22


@[NaHCOx](/space/show?uid=20487) [Luogu](https://www.luogu.org/discuss/show?postid=17055/)
by beng @ 2017-08-06 19:32:46


已完成,请提交重试
by icy @ 2017-08-06 20:17:48


神犇
by Henry_he @ 2017-08-07 10:08:01


#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<cstdlib> using namespace std; const double eps=1e-9; const int N=100+5; int dcmp(double x){ if(fabs(x)<eps)return 0; return x<0?-1:1; } struct point{ double x,y,z; }p[N],p1[N]; point operator - (point a,point b){ return (point){a.x-b.x,a.y-b.y,a.z-b.z}; } point cross(point a,point b){ 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}; } point cross(point a,point b,point c){ return cross(b-a,c-a); } double dot(point a,point b){ return a.x*b.x+a.y*b.y+a.z*b.z; } double sqr(double x){return x*x;} double length(point p){ return sqrt(sqr(p.x)+sqr(p.y)+sqr(p.z)); } struct face{ int v[3]; point normal(point *p)const{ return cross(p[v[0]],p[v[1]],p[v[2]]); } int cansee(point *p,int i)const{ return dot(p[i]-p[v[0]],normal(p))>0; } }; double rand01(){ return rand()/(double)RAND_MAX; } double randeps(){ return (rand01()-0.5)*eps; } point add_noise(point p){ return (point){p.x+randeps(),p.y+randeps(),p.z+randeps()}; } struct convexhull{ vector<face>ch; bool vis[N][N]; void increment(point *p,int n){ memset(vis,0,sizeof(vis)); for(int i=0;i<n;i++)p[i]=add_noise(p[i]); ch.clear(); ch.push_back((face){{0,1,2}}); ch.push_back((face){{2,1,0}}); for(int i=3;i<n;i++){ vector<face>tmp;tmp.clear(); for(int j=0;j<ch.size();j++){ face f=ch[j]; int res=f.cansee(p,i); if(!res)tmp.push_back(f); for(int k=0;k<3;k++)vis[f.v[k]][f.v[(k+1)%3]]=res; } for(int j=0;j<ch.size();j++) for(int k=0;k<3;k++){ int a=ch[j].v[k],b=ch[j].v[(k+1)%3]; if(vis[a][b]!=vis[b][a]&&vis[a][b]) tmp.push_back((face){a,b,i}); } ch=tmp; } } double area(point a,point b,point c){ return 0.5*length(cross(a,b,c)); } double area(face f,point *p){ return area(p[f.v[0]],p[f.v[1]],p[f.v[2]]); } double area(point *p){ double ans=0; for(int i=0;i<ch.size();i++) ans+=area(ch[i],p); return ans; } }sol; int main(){ //freopen("a.in","r",stdin); int n;scanf("%d",&n); for(int i=0;i<n;i++)scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].z); for(int i=0;i<n;i++)p1[i]=p[i]; sol.increment(p1,n); printf("%.6lf\n",sol.area(p)); return 0; }
by 暗黑神手 @ 2018-06-06 13:24:16


希望更丰富的展现?使用Markdown
by QAQQWQ @ 2019-08-05 19:48:37


|