摘要: 题意:给定n个物品,每个物品有两个价值,x,y,问能否从中选择一些物品(数量任意),使得sum(x)^2+sum(y)^2==s*s分析:二维费用的背包,dp[i][j]表示凑出两种费用分别为i,j的最小硬币数 1 #include<iostream> 2 #include<cstring> 3 #include<algorithm> 4 #define N 500 5 using namespace std; 6 const int inf=(1<<30); 7 int dp[N][N]; 8 int w1[N],w2[N]; 9 int ma 阅读全文
posted @ 2012-11-02 19:58 silver__bullet 阅读(157) 评论(0) 推荐(0) 编辑