
poj解题代码
Last0rder
最后之作
展开
-
poj3295
#include#include#includeusing namespace std;int K(int w,int x)//各逻辑判断实现 { if(w==1&&x==1) return 1; return 0;}int A(int w,int x){ if(w==0&&x==0) return 0; return 1;}int原创 2014-05-15 21:48:25 · 1113 阅读 · 0 评论 -
poj1852ant
poj上一道关于蚂蚁的题目原创 2014-07-05 13:54:08 · 1129 阅读 · 0 评论 -
poj2386Lake Counting
poj上一道有关水洼的题,我用dfs求水洼数,有更好的方法的朋友,欢迎讨论原创 2014-07-07 10:04:11 · 1048 阅读 · 0 评论 -
poj1094
拓扑排序C++实现原创 2014-06-01 14:25:30 · 1434 阅读 · 0 评论 -
poj1458求两个串的最大公共子序列咯
两个串的最大长度,题目里没说,随便写了个长度,过了。原创 2014-07-08 15:36:55 · 916 阅读 · 0 评论 -
poj3349
关于取余得哈希码,链表处理冲突的哈希查找,poj3349解题代码原创 2014-06-16 15:50:46 · 1788 阅读 · 0 评论 -
poj2388
#include#includeusing namespace std;bool cmp(int a,int b){ return a<b;}int main(){ int n,m,a[10010]; scanf("%d",&n); m=n; while(n--) scanf("%d",&a[n]); sort(a,a+m,cmp); printf("%d\n",a原创 2014-06-17 13:33:54 · 762 阅读 · 0 评论 -
poj2299
一个数列通过两两相邻的数进行原创 2014-06-17 13:39:09 · 806 阅读 · 0 评论 -
poj2531
poj2531,dfs+并查集原创 2014-06-17 14:41:00 · 1062 阅读 · 0 评论 -
poj3069Saruman's Army
poj一道贪心选点的题原创 2014-07-07 16:01:05 · 1124 阅读 · 0 评论 -
poj2503
poj2503,字符串的HASH,ELFhash函数的应用原创 2014-06-18 11:03:00 · 1429 阅读 · 0 评论 -
poj2635
大数取余以及求素数表比较好的方法,如果还有更好的方法,欢迎留言讨论原创 2014-06-22 22:50:17 · 1022 阅读 · 0 评论 -
poj1113Wall 求凸包周长 Graham扫描法
poj1113Wall 求凸包周长 Graham扫描法,欢迎讨论原创 2014-07-30 21:33:40 · 963 阅读 · 0 评论 -
poj2533Longest_Ordered_Subsequence
最长上升子序列。怎么做呢?不知道。书上说用dp。这样做的,dp[i]:长度为i的递增子序列,末尾元素最小的值。也就是说对于一个数列a,可以得到如下状态转移方程:dp[i]=a[j]>dp[i-1]?min(a[j],dp[i]):dp[i].这样的话容易得到如下代码:#include#include#includeusing namespace原创 2014-07-14 11:14:54 · 843 阅读 · 0 评论 -
旋转卡壳解poj3608Bridge Across Islands
继续上一次的旋转卡壳的问题,这次是求两个凸包的最短距离,其实选择卡壳就是只要找到"当前向量面积不小于下一个向量面积"即可,满足这个条件,当前的两个ymin和ymax点就是一对对踵点了。代码如下,欢迎参考:#include#include#includeusing namespace std;typedef struct{float x,y;} Dot;Dot operat原创 2014-09-04 19:52:00 · 957 阅读 · 0 评论 -
离散化坐标然后线段树解poj2528Mayor's posters
离散化坐标然后线段树解poj2528Mayor's posters,欢迎讨论原创 2014-08-13 13:00:53 · 913 阅读 · 0 评论 -
线段树+扫描线+离散化解poj1151 hdu 1542 ( Atlantis )
线段树+扫描线+离散化解poj1151 hdu 1542 ( Atlantis ),欢迎讨论原创 2014-08-15 15:24:59 · 1014 阅读 · 0 评论 -
旋转卡壳找凸包直径解poj2187Beauty Contest
第一次写旋转卡壳,所以对旋转卡壳部分做了较详细的注释。如果,知道了旋转卡壳的想法,而不太清楚如何实现的话,欢迎参考。#include#include#include#include#includeusing namespace std;typedef struct{int x,y;} Dot;Dot KEY;Dot operator -(Dot a,Dot b){D原创 2014-09-02 22:05:42 · 785 阅读 · 0 评论 -
poj3617Best Cow Line
poj一个字符串贪心的题,欢迎讨论原创 2014-07-07 14:09:27 · 984 阅读 · 0 评论 -
poj3206
poj3206原创 2014-05-31 13:52:53 · 1421 阅读 · 0 评论 -
poj2586
#includeint main(){ int s,d,n,temp; while(~scanf("%d%d",&s,&d)) { n=5*s/(s+d)+1;//一到五月有n个月是亏损的 temp=s*(12-2*n)-2*n*d;//1<=n<=3时,一年余额为temp if(n==4) temp-=s+d;//n等于4时再多算一个月亏损 else原创 2014-05-09 22:59:44 · 639 阅读 · 0 评论 -
poj2632
poj2632原创 2014-05-19 15:56:35 · 878 阅读 · 0 评论 -
poj1068
#include#includeusing namespace std;int main(){ int temp,p,n,t,N; bool v[20];//访问了第几个左括号(用0标记第一个左括号,从左往右数) ,访问之后标记为1,事先清零 scanf("%d",&t); while(t--) { p=0; memset(v,0,sizeof(v)); scanf原创 2014-05-19 14:17:44 · 786 阅读 · 0 评论 -
poj1573
poj1573原创 2014-05-19 19:28:48 · 921 阅读 · 0 评论 -
poj3041
poj3041解题代码,以及对匈牙利算法的一些基础进行解析供热切想要学习该算法的新手参考原创 2014-06-05 13:35:28 · 1118 阅读 · 0 评论 -
poj3122
关于题目中absolute error的真正含义(指正某些在此犯有千篇一律错误的解题报告)。同样,本文如有错误之处,欢迎指出。原创 2014-06-24 13:44:09 · 1219 阅读 · 0 评论 -
poj1011Sticks
poj1011Sticks传说中的poj必做50题之一……这是个传说中的搜索,渣渣我一开始TLE了四次……用到了比较多的剪枝,欢迎讨论原创 2014-07-17 16:39:46 · 1088 阅读 · 0 评论 -
poj1860
poj1860原创 2014-05-26 18:29:18 · 938 阅读 · 0 评论 -
poj3259
poj3259原创 2014-05-26 21:26:39 · 965 阅读 · 0 评论 -
poj2240
poj2240原创 2014-05-28 20:54:44 · 920 阅读 · 0 评论 -
poj2253
为了能用结构变量做形参,不能用c++里的结构体规则,至今不知为何……求高人指点原创 2014-05-28 13:45:15 · 1102 阅读 · 0 评论 -
poj1789
poj1789原创 2014-05-29 19:53:02 · 1286 阅读 · 0 评论 -
poj2485
poj2485原创 2014-05-29 20:40:59 · 1000 阅读 · 0 评论 -
poj2513
#include#includeusing namespace std;int trie[510000][26],bianhao[510000][26],degree[510000],f[510000],n,r;int insert(char *color){ int i,j,k,l; l=strlen(color); j=0; for(i=0;i<l;i++) { k=c原创 2014-06-13 19:01:30 · 793 阅读 · 0 评论 -
poj1258
poj1258原创 2014-05-29 21:45:09 · 1204 阅读 · 0 评论 -
poj3096
poj3096原创 2014-06-13 22:29:33 · 982 阅读 · 0 评论 -
poj1753-Flip Game(高斯消元枚举xor线性方程自由变元的值,找为1解的最少数量)
Flip GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 31227 Accepted: 13583DescriptionFlip game is played on a rectangular 4x4 field with two-sided pie原创 2014-10-05 16:45:18 · 1208 阅读 · 0 评论