上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 39 下一页
摘要: Problem Description现在有一些被简单压缩的字符串,例如:a[120]代表120个a。对于字符串acb[3]d[5]e相对于acbbbddddde现在给你两个字符串cString, nString.一个是被压缩过的字符串,另一个没有被压缩。求nString是否为cString的子串,... 阅读全文
posted @ 2015-03-24 16:18 Painting、时光 阅读(154) 评论(0) 推荐(0) 编辑
摘要: DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to... 阅读全文
posted @ 2015-03-24 14:37 Painting、时光 阅读(121) 评论(0) 推荐(0) 编辑
摘要: DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks... 阅读全文
posted @ 2015-03-23 10:33 Painting、时光 阅读(164) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3126大意:从一个素数到另一个素数,每次只能改变一个数,要求每次改变后的数都是素数,要求算出转换的最小次数,简单BFS,不过注意d要还原/************************************************* Auth... 阅读全文
posted @ 2015-03-22 16:06 Painting、时光 阅读(152) 评论(0) 推荐(0) 编辑
摘要: DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 a... 阅读全文
posted @ 2015-03-21 20:01 Painting、时光 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Prim:复杂度:O(n^2)用途:最小生成树算法,求一点到所有的位置之和的最小值,不是形成环,是把所有顶点连在一起的最短路适用条件:步骤:跟Dijkstra出奇的相似,只是prim把d和p都变成一个k数组(- -其实一样好吗)而且Dijkstra是第一个for为了记录下标,而prim是为了记录下标... 阅读全文
posted @ 2015-03-20 20:31 Painting、时光 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Dijkstra:复杂度:O(n^2)用途:求起点到终点的最短路径,不需要吧每个点走到适用条件:原理:利用邻接矩阵,用d数组记录最小值,用p标记是否用过这组数据。步骤:一大for,两小for,第一个小for用来的出当前的d中的最小值,为了得到下标,第二个小for用来更新map最小值,得出结果,循环整... 阅读全文
posted @ 2015-03-20 20:07 Painting、时光 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Floyed:复杂度:O(n^3)用途:求一条路走完所有的地方的的最小值,很简单,就三个for,一般写floyed不谢bellman_ford~~~适用条件:遍历所有的点,适合于稠密图,floyed与bellman_ford算法之间的区别就是floyed计算了从每一点开始的值,最后只要选取就行,方便... 阅读全文
posted @ 2015-03-20 19:49 Painting、时光 阅读(221) 评论(0) 推荐(0) 编辑
摘要: bin神----->传送门<-------unsigned int 0~4294967295 int 2147483648~2147483647 ——10^9unsigned long 0~4294967295long 2147483648~2147483647long long的最大值:92... 阅读全文
posted @ 2015-03-20 19:18 Painting、时光 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 快排:适用条件:方便...只要数字不是很多复杂度:O(nlogn) 每一层n复杂度,共logn层原理:利用一个随机数与最后面一个数交换,那么这个随机数就到了最后一位,然后循环,如果前面的数大于最后一个数,那么把这个数放到前面去,经过一次排序之后,前面的数都是大于最后一个的,然后对1到k和k+1到n进... 阅读全文
posted @ 2015-03-20 19:11 Painting、时光 阅读(375) 评论(0) 推荐(0) 编辑
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 39 下一页