摘要: 传送门: Palindrome Index Problem Statement Problem Statement You are given a string of lower case letters. Your task is to figure out the index of the ch 阅读全文
posted @ 2016-11-22 12:58 Pat 阅读(363) 评论(0) 推荐(0) 编辑
摘要: 游程编码(Run Length Coding, RLC)是串处理中常见的预处理方法。其写法是典型的双指针(Two-Pointer)。下面总结其写法1.输入为一串整数可以不把整数存在数组里 阅读全文
posted @ 2016-11-22 12:48 Pat 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Problem 求 $[1 \dots N]$中素因子数最多且最小的数 $n$,$N$ 充分大。 Solution 将任意自然数 $n$ ($n>2$) 分解 $$ n = p_1^{k_1 } p_2^{k_2} p_3^{k_3} \dots P_m^{k_m} \quad (p_1<p_2< 阅读全文
posted @ 2016-11-22 12:02 Pat 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 传送门 Problem Statement Problem Statement You are given a tree where each node is labeled from 1 to n. How many similar pairs(S) are there in this tree? 阅读全文
posted @ 2016-11-22 11:59 Pat 阅读(313) 评论(0) 推荐(0) 编辑
摘要: Problem: 给定无序序列S:[b, e),求S中第K大的元素。 Solution 1.裸排序 2.现将区间均分成两段,S1, S2,对S1,S2分别排序,然后 阅读全文
posted @ 2016-11-22 11:57 Pat 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Knights of the Round Table Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 10911 Accepted: 3587 Description Being a knight is a very attrac 阅读全文
posted @ 2016-11-22 11:50 Pat 阅读(332) 评论(0) 推荐(0) 编辑
摘要: Finally I fully understand the augmenting-path-based algorithm for maximum bipartite matching. 阅读全文
posted @ 2016-11-22 11:45 Pat 阅读(357) 评论(0) 推荐(0) 编辑
摘要: Problems (1) 给一棵带边权的树,求遍历这棵树(每个节点至少经过一次)再回到起点的最短路程。 答案是显然的:边权之和的两倍。 (2)给一棵带边权的树,求遍历这棵树(每个节点至少经过一次)的最短路程。 (3)给一棵带边权的树T(V, E ),求T的含K个节点的连通子图的边权和的最小值。 阅读全文
posted @ 2016-11-22 11:45 Pat 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 传送门 Problem Statement Ms.Kox enjoys her job, but she does not like to waste extra time traveling to and from her office. After working for many years, 阅读全文
posted @ 2016-11-22 11:43 Pat 阅读(578) 评论(0) 推荐(0) 编辑
摘要: ##[1001.Average](http://acm.hdu.edu.cn/showproblem.php?pid=5353) Summary $n$ people are sitting around a circle and every two adjacent people can exch 阅读全文
posted @ 2016-11-22 11:12 Pat 阅读(357) 评论(0) 推荐(0) 编辑