随笔分类 - ACM 图论入门算法
摘要:题目链接:HDU - 1599杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,....VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在860...
阅读全文
摘要:题目链接:HDU - 4857糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通道很窄,大家只能排成一行。现在有n个人,从1标号到n。同时有一些奇怪的约束条件,每个都形如:a必须在b之前。同时,社会是不平等的,这些人有的穷有的富。1号最富,2号第二富,以此类推。有钱人就贿赂负责人,所以他们有一些好处...
阅读全文
摘要:题目链接:HDU - 3062有n对夫妻被邀请参加一个聚会,因为场地的问题,每对夫妻中只有1人可以列席。在2n 个人中,某些人之间有着很大的矛盾(当然夫妻之间是没有矛盾的),有矛盾的2个人是不会同时出现在聚会上的。有没有可能会有n 个人同时列席?Inputn: 表示有n对夫妻被邀请 (n 2 #i...
阅读全文
摘要:题目链接:UVA - 10801题意描述:有n个电梯,给出每个电梯可以到达的楼层位置和电梯上升或下降一层楼的时间,另外在同一层楼换乘不同的电梯需要等待一分钟,问从楼层位置0(即地面)到第k层楼需要的最短时间是多少。算法分析:由于n很小(n 2 #include 3 #include 4 #inclu...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3926In order to get rid of Conan, Kaitou KID disguises himself as a teacher in the kindergarten. He kno...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1301The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4858我们建造了一个大项目!这个项目有n个节点,用很多边连接起来,并且这个项目是连通的!两个节点间可能有多条边,不过一条边的两端必然是不同的节点。每个节点都有一个能量值。现在我们要编写一个项目管理软件,这...
阅读全文
摘要:题目链接:http://poj.org/problem?id=1655Consider a tree T with N (1 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #define...
阅读全文
摘要:题目链接:http://poj.org/problem?id=1985After hearing about the epidemic of obesity in the USA, Farmer John wants his cows to get more exercise, so he has ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4607Claire and her little friend, ykwd, are travelling in Shevchenko's Park! The park is beautiful - bu...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1548There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(...
阅读全文
摘要:题目链接:http://poj.org/problem?id=2449"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his litt...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1285有N个比赛队(1 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define inf 0x7fffffff...
阅读全文
摘要:题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1001现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的,而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格的地形:左上角点为(1,1...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2853Last year a terrible earthquake attacked Sichuan province. About 300,000 PLA soldiers attended the ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2426For any school, it is hard to find a feasible accommodation plan with every student assigned to a s...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2255传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子...
阅读全文
摘要:题目链接:http://poj.org/problem?id=1422Consider a town where all the streets are one-way and each street leads from one intersection to another. It is als...
阅读全文
摘要:题目链接:http://poj.org/problem?id=1325As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very ...
阅读全文
摘要:寒假的第二周,弥补了一下图论算法。在这里做一下总结,主要针对近期学到的一些建模技巧,同时也非常感谢有朋友能够给出图论算法相关的精彩讲解或者知识链接。算法总结:欧拉回路问题:判断图是否存在欧拉回路或者欧拉通路,输出一条欧拉回路。学习Fleury算法输出一条欧拉回路。 1 /* G是连通无向图,则称经过...
阅读全文
浙公网安备 33010602011771号