81-POJ-Wall(计算几何)】的更多相关文章

Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a beautiful brick wall with a perfec…
代码1: #include<iostream> #include<stdio.h> #include<string> #include<string.h> #include<algorithm> #include<map> #include<list> #include<set> #include<vector> #include<queue> #include<iomanip&g…
职务地址:POJ 2954 意甲冠军:三个顶点的三角形,给出,内部需求格点数. 思考:就像POJ 1265. #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <algorithm> #include <set>…
/** 注意: 千万得小心..就因为一个分号,调了一个晚上... **/ #include <iostream> #include <algorithm> using namespace std; struct point { int x,y; }; struct line{ point a; point b; }; line l,lt;//l 直线 lt 矩形的边 int x1,x2,y1,y2; int mmax(double a,double b){ return a>…
#include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <cstdio> using namespace std; struct point { double x,y; }; point be[],en[]; ]; ]; double max(double a,double b){ return a>b?a:b; } doub…
/** 判断直线位置关系 **/ #include <iostream> #include <cmath> #include <cstdio> using namespace std; struct point { double x,y; point(,):x(x),y(y){} }; typedef point Vector; Vector operator - (point A,point B){ return Vector(A.x-B.x,A.y-B.y); }…
大意: 是否存在一条直线,使所有线段在直线上的投影至少交与一点 思路: 转换为是否存在一条直线与所有的线段相交,做这条直线的垂线,那么垂线即为所求 **/ #include <iostream> #include <cmath> using namespace std; int n; ; struct point{ double x,y; }; struct line{ point a,b; }; line l[]; double dis(point o,point p){ ret…
#include <iostream> #include<cstdio> #include<cstring> #include <algorithm> using namespace std; struct point{ int x,y; }; struct line{ point a,b; }; line lline[]; ]; ]; int cross(point p1,point p2,point p0){ return (p1.x-p0.x)*(p2…
凸包第一题. 自己认为自己写的是Andrew 其实就是xjb写出来居然过掉了测试. 刚开始把pi定义成了int,调了半天 #include <map> #include <cmath> #include <queue> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #def…
思路: 多边形面积->任选一个点,把多边形拆成三角,叉积一下 三角形重心->(x1+x2+x3)/3,(y1+y2+y3)/3 多边形重心公式题目中有,套一下就好了 计算多边形重心方法: (1)划分多边形为三角形:以多边形的一个顶点V为源点(V可取输入的第一个顶点),作连结V与所有非相邻顶点的线段,即将原N边形或分为(N-2)个三角形:(2)求每个三角形的重心和面积:设某个三角形的重心为G(cx,cy),顶点坐标分别为A1(x1,y1),A2(x2,y2),A3(x3,y3),则有cx = (…