摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=341排版问题 错了n次 注意除出来的列有可能为0 不处理为1 会RE 还有如果超过n个字符串 要break 有可能那一列不会满View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 typedef struct node 5 { 6 char c[61]; 阅读全文
posted @ 2012-07-19 23:48
_雨
阅读(193)
评论(0)
推荐(0)
摘要:
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2128有些忘记了View Code 1 #include<stdio.h> 2 #include<malloc.h> 3 typedef struct tree 4 { 5 struct tree *l,*r; 6 int data; 7 }tt; 8 int k; 9 void creat(tt *head,int a)10 {11 tt *p;12 p = (tt *)malloc(sizeof(tt));13 .. 阅读全文
posted @ 2012-07-19 20:39
_雨
阅读(211)
评论(0)
推荐(0)
摘要:
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2144转自http://www.cnblogs.com/pony1993/archive/2012/07/17/2595237.html克鲁斯卡尔(Kruskal)算法(只与边相关)算法描述:克鲁斯卡尔算法需要对图的边进行访问,所以克鲁斯卡尔算法的时间复杂度只和边又关系,可以证明其时间复杂度为O(eloge)。算法过程:1.将图各边按照权值进行排序2.将图遍历一次,找出权值最小的边,(条件:此次找出的边不能和已加入最小生成树集合的边构成环),若 阅读全文
posted @ 2012-07-19 19:54
_雨
阅读(381)
评论(0)
推荐(0)
摘要:
View Code 1 #include<stdio.h> 2 #include<string.h> 3 typedef struct que 4 { 5 int x,y; 6 long num; 7 }st; 8 st q[10001]; 9 char str[1001][1001]; 10 int f[1001][1001]; 11 int p,d; 12 void inque(int a,int b) 13 { 14 d++; 15 if(d>10000) 16 d = d%10000; 17 q[d].x = a; 1... 阅读全文
posted @ 2012-07-19 16:51
_雨
阅读(303)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=276实在没读懂题意 搜的意思 真佩服UVA的表达能力输入n,表示每个代码的长度为n;输入有多组数据,当n=0时表示结束;而在每组中,以最后输n个0结束。对于每组数据,第一行编码为出题者的(S1,S2,...,Sn),接下来的为猜测者的编码(g1,g2,g3,...gn)。若Si=gj并且i=j,你将得到个A;若Si=gj但i≠j,你将得到B。程序先从1找到n找能得到多少A,然后在找 阅读全文
posted @ 2012-07-19 11:11
_雨
阅读(321)
评论(0)
推荐(0)