
poj
傻笨
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj1543
http://poj.org/problem?id=1543这题属于暴搜,不会超时#include#includeusing namespace std;void sovle(int n){ int i,j,k; for(i=2;i*i*i { for(j=i;j*j*j { for原创 2013-04-26 20:49:30 · 561 阅读 · 0 评论 -
POJ 2318
这是一道计算几何题,题意大概是:在一个大矩形里有n条分割线把矩形分割成n+1部分、再给出一些玩具的坐标、要求统计每个部分内有多少个玩具、思路:利用二分N个区域来,然后利用叉乘来判断是不是在其区域类!这里要利用叉乘的一个性质:(1)P*Q>0,P在Q的顺时针 (2)P*Q==0 ,P和Q共线 (3)P*Q<0, P在Q的逆时针代码如下:#include #include #inc原创 2013-08-04 11:29:38 · 734 阅读 · 0 评论 -
POJ 2398
这道题目和上一道真是姐妹题目啊!就是多了一个排序,因为2318这题已经排好序了,而这题是没有排好序的!代码如下:#include #include #include #include using namespace std;const int maxn=1005;int num[maxn];int n,m;struct point{ d原创 2013-08-04 17:09:47 · 523 阅读 · 0 评论 -
poj 2773 欧几里得 一个拓展应用
题目大意就是给出n和k求出第k个与n互素的数这里涉及到了 欧几里得的一个重要知识点:如果(a, b)互质的话,那么(b*t+a, b)肯定互质,其中t为正整数!那么这就是以循环周期的了那么这题就可以利用这个来做了,代码和详解如下:#include #include #include #include using namespace std;const int maxn=100000原创 2013-08-06 11:24:00 · 582 阅读 · 0 评论 -
POJ 1654
这题目一开始就没有看懂,后来比赛结束后,看别人的报告,才知道什么意思,:在一个矩阵上面,一开始位于原点,现在你可以往8个方向走,每次走1个单位(上下左右)或者根号2个单位(其他四个方向)。现在给你每次走的方向,(保证最后回到原点)。问你做过的边多围成的多边形的面积是多少。1:西南 2:南 3:东南 4:西 5: 不走 6: 东 7:西北 8:北 9:东北 代码:#include原创 2013-08-06 16:40:46 · 560 阅读 · 0 评论 -
POJ 2954
第二道 用到pick定理的题目,一直错在一个地方了,后来才发现,代码:#include #include #include #include using namespace std;int gcd(int a,int b){ if(!a || !b) { return a>b?a:b; } else { r原创 2013-08-06 21:52:58 · 700 阅读 · 0 评论 -
poj 1265 多边形面积
今天做这个让我学到了一个pick 定理:pick定理: 设F为平面上以格子点为定点的单纯多边形,则其面积为:S=b/2+i-1。 b为多边形边上点格点的个数,i为多边形内部格点的个数。 可用其计算多边形的面积,边界格点数或内部格点数。代码和解析如下:#include #include #include #inclu原创 2013-08-06 19:38:33 · 600 阅读 · 0 评论 -
poj 3348
这题其实是一个简单的模板题,可我就纠结了好久!哎/* 这题就是凸包模板加多边形面积模板!*/#include #include #include #include #include using namespace std;const int maxn=10005;int n;struct point{ double x;原创 2013-08-08 09:28:05 · 663 阅读 · 0 评论 -
poj 2007 极角排序
极角排序有四种方法,我一开始就是先算出极角来,然后进行排序,可交上去却是WA,现在还没有搞,后面用另一种还是错了,最后用了这种才过的!代码如下:#include #include #include #include #include using namespace std;const int maxn=55;struct point{ double x,y;} p原创 2013-08-08 13:47:44 · 646 阅读 · 0 评论 -
poj 2187 凸包+平面上点之间最大距离
/* 这道题目是算一个平面内的一些点的之间最大的距离,暴力肯定会超时,最远距离,一定是凸包上的两个点的距离, 先用模板找到凸包线上的点,然后枚举任意两点之间的距离,求出最大的距离!*/#include #include #include #include #include using namespace std;const int maxn=50005;int n;原创 2013-08-08 14:58:41 · 725 阅读 · 0 评论 -
poj 1922
#include #include #include #include #include using namespace std;const int inf=0x3f3f3f3f;const int maxn=10005;int n;struct node{ int x; int y; double time;}p[maxn原创 2013-08-03 18:15:04 · 586 阅读 · 0 评论 -
POJ 3907
这是一道求多边形面积的题目,很水的!不过我好像又学到了新的知识点!#include #include #include #include #include using namespace std;const int maxn=105;int n;struct node{ double x; double y;} p[maxn];double solve(原创 2013-08-02 19:53:36 · 720 阅读 · 0 评论 -
poj 1995
这是一道快速幂取模的题目!难得找到啊!#include#includeusing namespace std;long long result(long long q,long long w,long long e){ long long anc=1; while(w) { if(w&1)anc=(anc*q)%e;原创 2013-05-11 15:34:35 · 607 阅读 · 0 评论 -
poj 2407
这是一道裸的欧拉函数题目:#include #include #include using namespace std;int euler(int x){ int unsigned i, res=x; for (i = 2; i if(x%i==0) { res = r原创 2013-05-28 16:46:41 · 517 阅读 · 0 评论 -
poj3268
最近一直在写最短路的题目!这道题目我本来是想要三种模板来写的,可发现用Floyd写错了,等改对了再来更新这种模板的解法!Dijkstra:#include #include #include using namespace std;const int maxn=1005;const int inf=0x3f3f3f3f;int map[maxn][maxn];int map1[m原创 2013-07-14 10:39:45 · 581 阅读 · 0 评论 -
poj 1789
这道题目一定要理解题意,题目大意是:历史上,曾用7个小写字母来表示每种truck的型号,每两种型号之间的差距为字母串中不同字母的个数代码如下:#include #include #include #include using namespace std;const int maxn=2005;const int inf=0x3f3f3f3f;int map[maxn][maxn]原创 2013-07-14 13:32:47 · 476 阅读 · 0 评论 -
HDU 1002
这是一道字符串的问题,看起来很难,其实只要你思路清晰,就会知道些了!#include #include #include #include #include using namespace std;const int maxn=100005;char s[maxn];int a[maxn];int pp(char c){ if(c=='A'||c=='B'||c=原创 2013-07-22 20:16:59 · 579 阅读 · 0 评论 -
POJ 3664
这道题目的意思就是,给你N头牛,先按第一列排序,(如果第一列有相同的,就按第二列排序),然后对前K头牛先按第二列排序,(如果有相同的,就按第一列排序),得到票数最高的这头牛在原来一开始的标号是多少!输出来代码如下:#include #include #include #include const int maxn=50005;using namespace std;struct p原创 2013-07-21 21:44:34 · 737 阅读 · 0 评论 -
POJ 1274 匈牙利算法
这道题目和上一题差不多,就是求的不同,这题求最大匹配!#include #include #include #include using namespace std;const int maxn=205;int mp[maxn][maxn];int mark[maxn];int pipei[maxn];int n,m;bool find(int x){ for(原创 2013-08-01 11:17:27 · 539 阅读 · 0 评论 -
POJ 2239
这道题目我有必要解释一下题意::在大学里有许许多多的课程,现在小明需要去选择课程,他是一个爱学习的人,所以想尽可能多的选择课程,在学校里有n个课程,并且在学校规定,每周里的每天有12节课,那么一周就有7*12节课。输入第一行为n,代表有n个课程接下来n行,每行第一个数字x代表这个课程在这一周里面需要上x次。然后跟着x对数字,第一个D代表这周的哪一天,第二个C代表这天的哪一节课原创 2013-08-01 12:33:54 · 600 阅读 · 0 评论 -
poj 1422 最短路径覆盖
我一开始不明白什么是最短路径覆盖,后面看了书,才知道二分图模型的应用中4种,分别是:1:最小点覆盖 2:最小边覆盖==最大独立点集 3:最短路径覆盖 4:最小点权覆盖最短路径覆盖==节点数--二分图最大匹配数(构造后的图)#include #include #include using namespace std;const int maxn=200;int mp[maxn][ma原创 2013-08-01 15:51:58 · 803 阅读 · 0 评论 -
poj 2406
原来KMP中有好多知识点啊!这题就是求周期!有一个公式:如果 len%(len-next[len])==0的话,那么周期==len/(len-next[len])否则就是输出 1代码如下:#include #include #include using namespace std;const int maxn=10000010;//这里注意不要开太大了,!int next1[原创 2013-09-04 19:50:30 · 511 阅读 · 0 评论