http://poj.org/problem?id=3211
按颜色分类,然后每种颜色的进行01背包即可。 无聊的题~~~~~~
code:
#include <iostream>
#include <cstring>
using namespace std;
const int maxn = 102;
const int maxm = 12;
struct tt {
char clr[11];
int cnt;
int sum;
int pdt[maxn];
} colors[maxn];
bool f[500005];
int main()
{
int i, j, k, n, m, ans, mid;
int x;
char tmp[11];
while(cin>>m>>n) {
if(n==0&&m==0) break......
阅读全文