HDU 3775 Chain Code pick定理】的更多相关文章

pick定理:一个计算点阵中顶点在格点上的多边形面积公式:S=a+b÷2-1,其中a表示多边形内部的点数,b表示多边形边界上的点数,s表示多边形的面积. 思路:http://blog.csdn.net/magicnumber/article/details/6192242 #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #define LL long l…
Pick定理运用在整点围城的面积,有以下公式:S围 = S内(线内部的整点个数)+ S线(线上整点的个数)/2 - 1.在这题上,我们可以用叉乘计算S围,题意要求的答案应该是S内+S线.那么我们进行推导以后得到ans=S内+S线=(S线+S围)/2+1-->另外,S线即是字符串的长度,那么本题得以解决. 代码如下: #include <stdio.h> #include <algorithm> #include <string.h> using namespace…
Area DescriptionBeing well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new research and development facility the company has installed the latest system of surveilla…
题目传送门 刷USACO偶然遇到的,可能是人生中第一道正儿八经的计算几何. 题目大意:在平面直角坐标系中给你一个以格点为顶点的三角形,求三角形中的整点个数. 因为必修5和必修2的阴影很快就想到了数学中的线性规划,求出两条直线的方程,然后枚举所有整点看是否满足条件.结果莫名其妙的挂掉了,样例过不了. 既然是计算几何萌新,那就看一看题解吧. 正解是一个定理-Pick定理,内容如下 “Pick定理是说,在一个平面直角坐标系内,如果一个多边形的顶点全都在格点上,那么这个图形的面积恰好就等于边界上经过的格…
题目链接:POJ 1265 Problem Description Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new research and development facility the company has installed the latest s…
http://poj.org/problem?id=2954 表示我交了20+次... 为什么呢?因为多组数据我是这样判断的:da=sum{a[i].x+a[i].y},然后!da就表示没有数据了QAQ我居然查了如此久都没查出来!!!!注意负数啊负数啊啊啊啊啊啊啊 本题是pick定理:当多边形的顶点均为整数时,面积=内部整点+边上整点/2-1 然后本题要求内部整点 #include <cstdio> #include <cstring> #include <cmath>…
样例: 输入:123 16 39 28 49 69 98 96 55 84 43 51 3121000 10002000 10004000 20006000 10008000 30008000 80007000 80005000 40004000 50003000 40003000 50001000 300040 01000000 01000000 10000000 100000040 0100 0100 1000 100 输出: 21 25990001 999998000001 9801 分析…
Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5429   Accepted: 2436 Description Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new resear…
链接:http://poj.org/problem?id=2954 Triangle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5043   Accepted: 2164 Description A lattice point is an ordered pair (x, y) where x and y are both integers. Given the coordinates of the vertices…
链接:http://poj.org/problem?id=1265 Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4969   Accepted: 2231 Description Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionag…