摘要: 水题,a56爆大奖在线娱乐却坑了好多时间,。。。 阅读全文
posted @ 2014-06-17 23:25 人艰不拆_zmc 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 主要是思维,dis[s][t]数组的作用 阅读全文
posted @ 2014-06-17 20:46 人艰不拆_zmc 阅读(178) 评论(0) 推荐(0) 编辑
摘要: [题目大意]:给定一个字符串,求到哪一位时的字串是前几位循环组成的,并求出循环次数。 思路:求a56爆大奖在线娱乐前缀的最小循环周:从i到n枚举len,如果len%(len-next[len])==0,则这个前缀是由循环节组成的,且循环次数为len/(len-next[len])//len为当前i的值,next[l 阅读全文
posted @ 2014-06-17 19:58 人艰不拆_zmc 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>char a[1000001];int next[1000001];int l;void Getnext(){ int j=-1; int i=0; next[0]=-1;//忘写了,死循 阅读全文
posted @ 2014-06-17 18:58 人艰不拆_zmc 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>char a[1000001],b[1000001];int next[1000001];int l,l2;void Getnext(){ int i=0; int j=-1; next[ 阅读全文
posted @ 2014-06-17 18:37 人艰不拆_zmc 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 当然,对于Spfa判负环,实际上还有优化:就是把判断单个点的入队次数大于n改为:如果总的点入队次数大于所有点两倍 时有负环,或者单个点的入队次数大于sqrt(点数)有负环。这样时间复杂度就降了很多了。 判断给定的有向图中是否存在负环。 利用 spfa 算法判断负环有两种方法: 1) spfa 的 d 阅读全文
posted @ 2014-06-16 19:10 人艰不拆_zmc 阅读(604) 评论(0) 推荐(0) 编辑
摘要: #include#include#includeint k,h[110],mark;struct M{ int data; struct M *next;}*head[110];void init(){ int i; for(i = 0; i next = NULL; ... 阅读全文
posted @ 2014-06-15 20:48 人艰不拆_zmc 阅读(162) 评论(0) 推荐(0) 编辑
摘要: #include#includeint d[15],map[15][15],vis[15];int main(){ int i,j,k,f,n,m,u,v; while(~scanf("%d%d",&n,&m)) { memset(d,0,sizeof(d)); memset(map,0,sizeo... 阅读全文
posted @ 2014-06-15 20:04 人艰不拆_zmc 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Flip Game 思想很不成熟, #include <stdio.h>#include <string.h>#include <stdlib.h>int map[4][4];int ans=100; int f(){ for(int i=0;i<4;i++) { for(int j=0;j<4;j 阅读全文
posted @ 2014-06-14 19:47 人艰不拆_zmc 阅读(253) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <stdio.h>#include <string.h>#include <stdlib.h>using namespace std;int n,m;int bin[50001];int findx(int x){ int r=x; while 阅读全文
posted @ 2014-06-13 16:25 人艰不拆_zmc 阅读(621) 评论(0) 推荐(0) 编辑
摘要: 比较抽象吧,看到题时一点思想也没有,参考了别人的代码才知道。。。渣渣 #include <iostream>#include <stdio.h>#include <string.h>#include <stdlib.h>using namespace std;int map[10][10];int 阅读全文
posted @ 2014-06-13 15:22 人艰不拆_zmc 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>int map[51][51][51];int v[51][51][51];int a,b,c,t11;struct node{ int x,y,z,ans;}q[200001];int jx[6]={0,0,0,0,-1,1 阅读全文
posted @ 2014-06-12 20:31 人艰不拆_zmc 阅读(209) 评论(0) 推荐(0) 编辑
摘要: dfs #include <stdio.h> #include <string.h> char Map[16][16]; int mv[16][16]; //mv[i][j] == 0 没有被访问 //mv[i][j] == 1 已经被访问 struct N { int x,y; } ; int j 阅读全文
posted @ 2014-06-12 19:30 人艰不拆_zmc 阅读(362) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3259 Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is ver 阅读全文
posted @ 2014-06-09 21:09 人艰不拆_zmc 阅读(333) 评论(0) 推荐(0) 编辑
摘要: BF是对边进行操作,DJ是对点进行操作。N个顶点的最短路是N-1条边,a56爆大奖在线娱乐循环N-1次。 学的好吃力。。。自己好渣渣。。。不愧是渣渣二号,还是贴贴思想吧 1,.初始化:将除源点外的所有顶点的最短距离估计值 d[v] ←+∞, d[s] ←0; 2.迭代求解:反复对边集E中的每条边进行松弛操作,使得顶 阅读全文
posted @ 2014-06-09 14:45 人艰不拆_zmc 阅读(299) 评论(0) 推荐(0) 编辑