2012年1月17日
摘要: 这题主要用到PICK公式即:area = I + E/2 - 1.(I为多边形内的格点数,E为边上的格点数,area为多边形面积)用GCD可以算出一条边上的格点-1个,那么3×GCD即为3条边上的所有格点数(因为每个条边的顶点多算了一次)。。。View Code 1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 5 struct point { 6 int x, y; 7 }; 8 9 int pick(int area, int num)10 {11 return (area - 阅读全文
posted @ 2012-01-17 16:43 Dev-T 阅读(664) 评论(0) 推荐(0) 编辑
摘要: 这题要注意一点就是数据类型的选择。。。一定要选__int64或者long long,否则很容易出问题。其余的就是直接用公式。。。。。View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #define MAXN 1000004 5 #define END 5 6 using namespace std; 7 __int64 dir[10][2]; 8 struct point { 9 __int64 x, y; 10 };11 12 char data[MAXN];13 阅读全文
posted @ 2012-01-17 14:57 Dev-T 阅读(256) 评论(0) 推荐(0) 编辑