摘要: DescriptionInhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteer... 阅读全文
posted @ 2017-07-17 20:31 mlzc 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 什么是并查集?并查集是一种树型的数据结构,常用于处理一些不相交集合(Disjoint Sets)的合并及查询问题。并查集可以高效的进行如下操作:合并两个不相同的集合判断两个元素是否属于同一个集合并查集常见操作init()初始化所有元素独立为一个集合(即父节点是自身)定义数组fa[],fa[x]存储x... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 动态规划动态规划算法通常基于一个递推公式及一个或多个初始状态。 当前子问题的解将由上一次子问题的解推出。使用动态规划来解题只需要多项式时间复杂度, 因此它比回溯法、暴力法等要快许多。状态和状态转移方程例子:01背包问题有 n 个价值和重量分别为 v[i] 和 w[i] 的物品和一... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(82) 评论(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) 编辑
摘要: 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) 编辑
摘要: 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) 编辑
摘要: 看病要排队这个是地球人都知道的常识。不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(162) 评论(0) 推荐(0) 编辑
摘要: ACboy was kidnapped!!he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(.As ... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值。 Input测试输入包含若干测试用例,每个测试用例占一行,每行不超过200个字符,整数和运算符之间用一个空格分隔。没有非法表达式。当一行中只有0时输入结束,相应的结果不要输出。 Output对每个测试用... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(175) 评论(0) 推荐(0) 编辑
摘要: The cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standar... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(54) 评论(0) 推荐(0) 编辑