随笔分类 - acm 解题报告
摘要:题目:http://acm.hdu.edu.cn/diy/contest_show.php?cid=20083密码:shuacm感觉他们学校的新生训练出的比较好。今天很多题目都是强化了背包的转化。关于背包转化成求最优解见分析:点击打开链接贴个背包的模板://0-1背包, 代价为 cost, 获得的价值为 weight
// 每种物品最多只可以选一次
void ZeroOnePack(int cost, int weight)
{ for(int i = nValue; i >= cost; i--) dp[i] = dp[i] + dp[i-cost]+weight;
...
阅读全文
摘要:原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2037CSUST链接:http://acmore.net:8080/contest/view.action?cid=2#problem/F今年暑假不ACTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18515Accepted Submission(s): 9625Problem Description“今年暑假不AC?”“是的。”“那你干什么呢?”
阅读全文
摘要:原题链接:http://poj.org/problem?id=3280CSUST:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=20437#problem/C转载来自:http://blog.sina.com.cn/s/articlelist_1836701754_0_1.htmlCheapest PalindromeTime Limit:2000MSMemory Limit:65536KTotal Submissions:4305Accepted:2091DescriptionKeeping track of all the co
阅读全文
摘要:原题链接:http://poj.org/problem?id=1159博文转载链接:http://blog.sina.com.cn/s/blog_6d79d83a01016iqg.htmlPalindromeTime Limit:3000MSMemory Limit:65536KTotal Submissions:45704Accepted:15580DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from righ
阅读全文
摘要:原题链接:http://poj.org/problem?id=3624我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=20437#problem/A欢迎来水Charm BraceletTime Limit:1000MSMemory Limit:65536KTotal Submissions:14963Accepted:6840DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she
阅读全文
摘要:原题链接:http://poj.org/problem?id=3928我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=20357#problem/APing pongTime Limit:1000MSMemory Limit:65536KTotal Submissions:1215Accepted:452DescriptionN(3<=N<=20000) ping pong players live along a west-east street(consider the street as a line se
阅读全文
摘要:原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1022Train Problem ITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13410Accepted Submission(s): 4935Problem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of
阅读全文
摘要:原题链接:http://poj.org/problem?id=2299Ultra-QuickSortTime Limit:7000MSMemory Limit:65536KTotal Submissions:31043Accepted:11066DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence eleme
阅读全文
摘要:原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23954Accepted Submission(s): 10387Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地
阅读全文
摘要:原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1233CSUST链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=19760#problem/D还是畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17151Accepted Submission(s): 7688Problem Description某省调查乡村交通状况,得到的
阅读全文
摘要:原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1232CSUST链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=19760#problem/C畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19633Accepted Submission(s): 10103Problem Description某省调查城镇交通状况,得到现有
阅读全文
摘要:PS:第一道并查集题目Orz链接:http://acm.hdu.edu.cn/showproblem.php?pid=1878CSUST链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=10462#problem/A欧拉回路Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7271Accepted Submission(s): 2548Problem Description欧拉回路是
阅读全文
摘要:DFS 水题原题链接:http://poj.org/problem?id=3620我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=19651#problem/BAvoid The LakesTime Limit:1000MSMemory Limit:65536KTotal Submissions:5563Accepted:2995DescriptionFarmer John's farm was flooded in the most recent storm, a fact only aggravated by t
阅读全文
摘要:最短路的简单应用问题。原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=3790CSUST链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=19760#problem/L最短路径问题Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6346Accepted Submission(s): 1922Problem Description给你n个
阅读全文
摘要:原题链接:http://poj.org/problem?id=1062我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=19651#problem/E昂贵的聘礼Time Limit:1000MSMemory Limit:10000KTotal Submissions:29628Accepted:8296Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,
阅读全文
摘要:原题链接:http://poj.org/problem?id=1847我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=19651#problem/D最短路模板题。TramTime Limit:1000MSMemory Limit:30000KTotal Submissions:7960Accepted:2861DescriptionTram network in Zagreb consists of a number of intersections and rails connecting some of them. In
阅读全文
摘要:题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1076我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=19651#problem/H1076. TrashTime Limit: 1.0 secondMemory Limit: 16 MBDescriptionYou were just hired as CEO of the local junkyard.One of your jobs is dealing with the incoming trash and
阅读全文
摘要:原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=3488我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=17728#overviewTourTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1147Accepted Submission(s): 604Problem DescriptionIn the kingdom of Henr
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1853我的链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=17728#problem/CKM算法模板:http://blog.csdn.net/cfreezhan/article/details/8246639用KM求最小费用模板题:http://blog.csdn.net/cfreezhan/article/details/8256926Cyclic TourTime Limit: 1000/1000 MS (Java/Others
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2813我的链接:http://acm.hust.edu.cn:8080/judge/contest/view.action?cid=17728#problem/L算法思想:二分图的最优匹配求最小权覆盖,吕布的战将为集合一(二分图的行),曹操的战将为集合二(二分图的列),如果两边的战将间有战争就连边,建图。 然后直接套模板即可。 题目的关键是如何输入且存储两边的战将名字,这里用到了C++中STL的map容器,水过了。PS:大牛说字典树最快。 STL的map: 头文件#include<map>
阅读全文

浙公网安备 33010602011771号