标签:class div span ret col ati bit ace ++
这是道完全背包问题,一共有N个数,且每个数可重复。
#include <bits/stdc++.h> using namespace std; int main() { int n = 120; int dp[121] = {1}; for (int i = 1; i <= n; i++) { for (int j = i; j <= n; j++) { dp[j] += dp[j-i]; } } while (cin >> n) { cout << dp[n] << endl; } return 0; }
HDU1028 - Ignatius and the Princess III
标签:class div span ret col ati bit ace ++
原文地址:https://www.cnblogs.com/oeong/p/12043822.html