摘要: Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to th... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(89) 评论(0) 推荐(0) 编辑
摘要: Queues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, t... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 基本运算取模(mod)取余(rem)定义给定一个正整数p,任意一个整数n,一定存在等式 :n = kp + r ;其中 k、r 是整数,且 0 ≤ r a|c对任意整数a,b,b>0,存在唯一的数对q,r,使a=bq+r,其中0≤r1) fact[cnt][0]=n,fact[... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 动态规划动态规划算法通常基于一个递推公式及一个或多个初始状态。 当前子问题的解将由上一次子问题的解推出。使用动态规划来解题只需要多项式时间复杂度, 因此它比回溯法、暴力法等要快许多。状态和状态转移方程例子:01背包问题有 n 个价值和重量分别为 v[i] 和 w[i] 的物品和一... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 什么是并查集?并查集是一种树型的数据结构,常用于处理一些不相交集合(Disjoint Sets)的合并及查询问题。并查集可以高效的进行如下操作:合并两个不相同的集合判断两个元素是否属于同一个集合并查集常见操作init()初始化所有元素独立为一个集合(即父节点是自身)定义数组fa[],fa[x]存储x... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Ubiquitous ReligionsThere are so many different religions in the world today that it is difficult to keep track of them all. You are interes... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of themaximum positive product involving conse... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(82) 评论(0) 推荐(0) 编辑
摘要: /*给定一个序列 序列内部数字自由组合 求最大乘积*/#include #include #include #define T 30 //30为数组最大长度void quick_sort(int s[], int l, int r){ int i, j, x; i... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(258) 评论(0) 推荐(0) 编辑
摘要: UVA 10082 - WERTYUA common typing error is to place thehands on the keyboard one row to theright of the correct position. So ‘Q’ istyped as ... 阅读全文
posted @ 2017-07-17 20:19 mlzc 阅读(93) 评论(0) 推荐(0) 编辑
摘要: C字符串-字符数组输入输出函数输入函数scanf("%s", s)读入字符串,在第一个空白符(' '、'\n'、'\t')处停止,不读入空白符,在串尾自动添加'\0'。(%*c表示读入并舍弃,可用于"吃掉"末尾的回车)gets(s)读入一行字符,直到遇到'\n',读入换行符并将其... 阅读全文
posted @ 2017-07-17 20:19 mlzc 阅读(272) 评论(0) 推荐(0) 编辑