Fence9】的更多相关文章

Electric Fence题解 Don Piele In this problem, `lattice points' in the plane are points with integer coordinates. In order to contain his cows, Farmer John constructs a triangular electric fence by stringing a "hot" wire from the origin (0,0) to a…
题目大意: 求点(0,0),(n,m),(p,0)三点构成的三角形内部(不包括边界)整点的个数. 解题过程:1.直接枚举纵坐标,然后算出两条直线上纵坐标为y的点的横坐标,然后他们中间的点就是符合要求的.边界处理超级恶心.要特判直线没有斜率的情况,n=0或者p=n的情况.搞了好几次才AC. 2.nocow上的题解: 皮克定理说明了顶点是整点的多边形面积S和内部格点数目a.边上格点数目b的关系:S = a + b/2 - 1.根据三角形面积公式求出S.如果知道了b,那么三角形内部格点数目a也就求出来…
忘记pick定理是什么了 想枚举来着 ..没枚出来 有篇pick定理的证明 貌似挺好 也没太看懂 /* ID: shangca2 LANG: C++ TASK: fence9 */ #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> using namespace std; int gcd(int x,int y…
Electric FenceDon Piele In this problem, `lattice points' in the plane are points with integer coordinates. In order to contain his cows, Farmer John constructs a triangular electric fence by stringing a "hot" wire from the origin (0,0) to a lat…