摘要: DescriptionFarmer John has built a new long barn, with N (2 #include #include #include#include using namespace std;const int N = ... 阅读全文
posted @ 2017-07-17 20:48 mlzc 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑
摘要: 畅通工程某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(82) 评论(0) 推荐(0) 编辑
摘要: HDU 1272 - 小希的迷宫上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(58) 评论(0) 推荐(0) 编辑
摘要: POJ 1703 - Find them, Catch themThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs ... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(79) 评论(0) 推荐(0) 编辑
摘要: POJ 1611 - The Suspects Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global thr... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(77) 评论(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) 编辑
摘要: 读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值。 Input测试输入包含若干测试用例,每个测试用例占一行,每行不超过200个字符,整数和运算符之间用一个空格分隔。没有非法表达式。当一行中只有0时输入结束,相应的结果不要输出。 Output对每个测试用... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(175) 评论(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) 编辑
摘要: 看病要排队这个是地球人都知道的常识。不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别... 阅读全文
posted @ 2017-07-17 20:20 mlzc 阅读(162) 评论(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) 编辑
摘要: 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) 编辑