摘要: spfa--周冬《两极相通——浅析最大—最小定理在信息学竞赛中的应用》 虽然是网络流最小割,但是我们可以转换一下,转成最短路 简单点讲,每个平面图都对应一个对偶图,对偶图中的最小环就是原图的最小割,如果删去对偶图中s-t这条边,就是相当于求最短路了! 建图十分玄学,建完后跑一遍spfa就好了。 #i 阅读全文
posted @ 2017-10-23 17:28 新手-周 阅读(173) 评论(0) 推荐(0) 编辑
摘要: void getnext(){ int j=0;k=-1; next[0]=-1; while(j<tlen) if(k 1||T[j]==T[k])next[++j]=++k; else k=next[k];}int kmp_index(){ int i=0,j=0; getnext() whil 阅读全文
posted @ 2017-09-12 20:19 新手-周 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 讲解请参考这位大佬的博客:http://www.cnblogs.com/biyeymyhjob/archive/2012/07/31/2615833.html 阅读全文
posted @ 2017-09-07 21:17 新手-周 阅读(243) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #define maxedge 20000 #define maxn 5000 //结点数 #define inf 1distance[j])) k=j; vist[k]=true; for(j=headlist[k];j!=-1;j=edge[j].n... 阅读全文
posted @ 2017-08-02 22:31 新手-周 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Consider a tropical forrest, represented as a matrix. The cell from the right top corner of the matrix has the coordinates (1,1), and the coordinates 阅读全文
posted @ 2017-07-27 18:17 新手-周 阅读(381) 评论(0) 推荐(0) 编辑
摘要: 给定一棵二叉树的前序遍历和中序遍历的结果,求其后序遍历。 输入 输入可能有多组,以EOF结束。每组输入包含两个字符串,分别为树的前序遍历和中序遍历。每个字符串中只包含大写字母且互不重复。 输出 对于每组输入,用一行来输出它后序遍历结果。 理论知识可以参考这个大佬的博客: http://cache.b 阅读全文
posted @ 2017-07-26 20:27 新手-周 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 描述Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other 阅读全文
posted @ 2017-07-24 20:43 新手-周 阅读(475) 评论(0) 推荐(0) 编辑
摘要: Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But she was 阅读全文
posted @ 2017-07-24 20:31 新手-周 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 这道题有两种做法,一是直接暴力枚举天数(居然没炸!!!???)而是我们可以发现,一年中最多只有一天可以形成回文日期。那么,我们只需要枚举年份,然后再判断所对应的月,日是否符合逻辑,和规定日期然后就可以了 以下是代码 #include <stdio.h>char a[10],b[10];int len 阅读全文
posted @ 2016-11-26 23:55 新手-周 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 这个问题非常弱智,向上取整直接码代码 #include <stdio.h>int n,a1,b1,c1,a2,b2,c2,ans1,ans2,ans3,ans;int min(int a,int b){ if(a<=b)return a; else return b;}int main(){ sca 阅读全文
posted @ 2016-11-26 23:50 新手-周 阅读(175) 评论(0) 推荐(0) 编辑