摘要: Description 要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 Input 数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 using namespace std;... 阅读全文
posted @ 2014-11-17 18:01 星斗万千 阅读(136) 评论(0) 推荐(0)
摘要: Description Graph algorithms form a very important part of computer science and have a lineage that goes back at least to Euler and the famous Sev... 阅读全文
posted @ 2014-11-14 18:25 星斗万千 阅读(271) 评论(0) 推荐(0)
摘要: Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a l... 阅读全文
posted @ 2014-11-13 19:58 星斗万千 阅读(224) 评论(0) 推荐(0)
摘要: Description Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because ... 阅读全文
posted @ 2014-11-13 17:27 星斗万千 阅读(161) 评论(0) 推荐(0)
摘要: 【2-SAT问题】 现有一个由N个布尔值组成的序列A,给出一些限制关系,比如A[x] AND A[y]=0、A[x] OR A[y] OR A[z]=1等,要确定A[0..N-1]的值,使得其满足所有限制关系。这个称为SAT问题,特别的,若每种限制关系中最多只对两个元素进行限制,则称为2-SA... 阅读全文
posted @ 2014-11-10 21:24 星斗万千 阅读(191) 评论(0) 推荐(0)
摘要: 在有向图G中,如果任意两个不同的顶点相互可达,则称该有向图是强连通的。有向图G的极大强连通子图称为G的强连通分支。 把有向图分解为强连通分支是深度优先搜索的一个经典应用实例。下面介绍如何使用两个深度优先搜索过程来进行这种分解,很多有关有向图的算法都从分解步骤开始,这种分解可把原始的问题分成数个子... 阅读全文
posted @ 2014-11-10 21:22 星斗万千 阅读(1447) 评论(0) 推荐(1)
摘要: 欧拉回路 欧拉环:图中经过每条边一次且仅一次的环; 欧拉路径:图中经过每条边一次且仅一次的路径; 欧拉图:有至少一个欧拉环的图; 半欧拉图:没有欧拉环,但有至少一条欧拉路径的图。 【无向图】 一个无向图是欧拉图当且仅当该图是连通的(注意,不考虑图中度为0的点,因为它们的存在对于图中是否存在... 阅读全文
posted @ 2014-11-10 21:11 星斗万千 阅读(314) 评论(0) 推荐(0)
摘要: Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Sched... 阅读全文
posted @ 2014-11-08 10:55 星斗万千 阅读(115) 评论(0) 推荐(0)
摘要: Description On the upcoming conference were sent M representatives of country A and N representatives of country B (M and N ≤ 1000). The repres... 阅读全文
posted @ 2014-11-08 10:23 星斗万千 阅读(135) 评论(0) 推荐(0)
摘要: Description A power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be sup... 阅读全文
posted @ 2014-11-08 08:43 星斗万千 阅读(155) 评论(0) 推荐(0)