链接: http://acm.timus.ru/problem.aspx?space=1&num=1348 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27498#problem/A 1348. Goat in the Garden 2 Time limit: 1.0 second Memory limit: 64 MB A goat is tied to a peg (in a point C) in a garden with…
题目链接:https://vjudge.net/problem/POJ-1584 题意:首先要判断凸包,然后判断圆是否在多边形中. 思路: 判断凸包利用叉积,判断圆在多边形首先要判断圆心是否在多边形中,然后判断圆心到每条边的距离是否小于半径.板子很重要!! AC code: #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<cstdlib>…
http://acm.timus.ru/problem.aspx?space=1&num=1348 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; ; double dcmp(double x){ ; ?-:; } double sqr(double x) { return x*x; } struct nod…
A Round Peg in a Ground Hole Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4438   Accepted: 1362 Description The DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to on…
1298 圆与三角形 给出圆的圆心和半径,以及三角形的三个顶点,问圆同三角形是否相交.相交输出"Yes",否则输出"No".(三角形的面积大于0).   收起   输入 第1行:一个数T,表示输入的测试数量(1 <= T <= 10000),之后每4行用来描述一组测试数据. 4-1:三个数,前两个数为圆心的坐标xc, yc,第3个数为圆的半径R.(-3000 <= xc, yc <= 3000, 1 <= R <= 3000) 4…
http://poj.org/problem?id=1584 题意 按照顺时针或逆时针方向输入一个n边形的顶点坐标集,先判断这个n边形是否为凸包. 再给定一个圆形(圆心坐标和半径),判断这个圆是否完全在n边形内部. 分析 1.判断给出了多边形是不是凸多边形. 2.判断圆包含在凸多边形中:一定要保证圆心在凸多边形里面.然后判断圆心到每条线段的距离要大于等于半径.. #include <iostream> #include <stdio.h> #include <string.h…
首先判断是不是凸多边形 然后判断圆是否在凸多边形内 不知道给出的点是顺时针还是逆时针,所以用判断是否在多边形内的模板,不用是否在凸多边形内的模板 POJ 1584 A Round Peg in a Ground Hole(判断凸多边形,点到线段距离,点在多边形内) #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath&g…
求点到直线的距离: double dis(point p1,point p2){   if(fabs(p1.x-p2.x)<exp)//相等的  {    return fabs(p2.x-pegx);    }  else     {   double k=(p2.y-p1.y)/(p2.x-p1.x);   double b=p2.y-k*p2.x;   return fabs(k*pegx-pegy+b)/sqrt(k*k+1);//返回的是距离的   }}判断多边形是否为凸多边形 if…
/****点到直线的距离*** * 过点(x1,y1)和点(x2,y2)的直线方程为:KX -Y + (x2y1 - x1y2)/(x2-x1) = 0 * 设直线斜率为K = (y2-y1)/(x2-x1),C=(x2y1 - x1y2)/(x2-x1) * 点P(x0,y0)到直线AX + BY +C =0DE 距离为:d=|Ax0 + By0 + C|/sqrt(A*A + B*B) * 点(x3,y3)到经过点(x1,y1)和点(x2,y2)的直线的最短距离为: * distance =…
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1503 1503: 点到圆弧的距离 时间限制: 1 Sec  内存限制: 128 MB  Special Judge 提交: 247  解决: 59 [提交][状态][讨论版] 题目描述 输入一个点P和一条圆弧(圆周的一部分),你的任务是计算P到圆弧的最短距离.换句话说,你需要在圆弧上找一个点,到P点的距离最小. 提示:请尽量使用精确算法.相比之下,近似算法更难通过本题的数据. 输入 输入包含最多…