经典的0-1背包问题。代码中的backtracking部分是输出组成最大价值的编号。 // runtime: 4ms // space: 728K #include <iostream> #include <algorithm> #include <stack> using namespace std; int main() { int c, n; // c for count, n for number; while (cin>> c >> n) { int dp[n + 1][c + 1]; int price[n + 1], m...