摘要: 一开始发现费用不会超过¥50,很happy 以为可以开个dp[50+m]的数组就可以。发现不怎么能直接套01背包。。然后经队长提点 了然 真相是:排序。。显然的在剩下钱数多于5时 应尽量用小钱填 在最后用大钱一举破处-。-所以 要先用个sort(),把最大数分开 把其他数01.so….end。 臭臭的代码如下。。: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <string.h> 5 6 using namespace std; 7 8 i 阅读全文
posted @ 2011-03-01 14:52 luxury 阅读(212) 评论(0) 推荐(0) 编辑