摘要: http://poj.org/problem?id=1742背包真的很神奇啊;题意:给你一些硬币,每种硬币有一定的价值和数目,用这些硬币能组合成多少小于s的组合;思路:采用背包,在这里要加一个记录个数的数组num[],这样就变成二维的了,减少了时间;View Code #include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int main(){ int n,s,ans[100010],num[100010],val[110 阅读全文
posted @ 2011-12-07 20:55 LT-blogs 阅读(204) 评论(0) 推荐(0) 编辑
摘要: http://acm.sdut.edu.cn/web/problem.php?action=showproblem&problemid=1566这是上个星期测试赛的最后一个题目,那天真是悲剧了,一个也没做出来,;思路:采用VONGONG的思路做的,用bfs搜索来找:View Code #include<cstdio>#include<iostream>#include<algorithm>#include<string.h>using namespace std;int map[55][55];int p(int w){ int temp 阅读全文
posted @ 2011-12-07 19:31 LT-blogs 阅读(304) 评论(0) 推荐(0) 编辑