摘要: 这里可以看成给一个面值为m的钱币,要求将它换成n种不同的面值都为1的钱币,同时要求每种钱币供应的上下限。然后就是生成函数模板了。。。My Code:#include <iostream>#include <cstring>#include <cstdio>using namespace std;const int N = 110;int c1[N], c2[N];int MIN[N], MAX[N];int main() { //freopen("data.in", "r", stdin); int n, m, i, 阅读全文
posted @ 2011-11-25 21:59 AC_Von 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 没有看到Your program should be able to handle up to 100 coins. WA了n次。。。处理起来有点麻烦,看到大牛的思路是开一个二维数组c[i][j],表示用j个硬币组成大小为i的数。把j限定在100以下(有点dp的感觉,呵呵)。就可以了。详见代码:#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int N = 250;int c1[N+1][N+1], c2[N+1][N+1];int val[5] 阅读全文
posted @ 2011-11-25 21:28 AC_Von 阅读(276) 评论(0) 推荐(0) 编辑
摘要: /*用砝码秤重量,按照左物右码的话,砝码的值可以取负。因为砝码最多就一个,所以不许要一般模板里的k 那一重循环,直接去砝码个数为0, 1的两种情况就行。开始把重量取负时那种情况想错了,WA了好几次。。。T_T*///My Code:#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int N = 10007;int c1[N], c2[N];int val[107];int main() { //freopen("data.in" 阅读全文
posted @ 2011-11-25 20:13 AC_Von 阅读(263) 评论(0) 推荐(0) 编辑