摘要:
UVA_357 用dp进行计数即可,状态转移方程为f[i,j]=Sum{f[i][j-k*a[i]]}(j-k*a[i]>=0,k为整数),其中i代表第i种面值,j代表当前有j的cents,a[i]为第i种面值的大小。#include<stdio.h>#include<string.h>#define MAXD 30010int d[] = {1, 5, 10, 25, 50};long long int f[10][MAXD];void prepare(){ int i, j, k; memset(f, 0, sizeof(f)); for(i = 0; i & 阅读全文