摘要:
#includeusing namespace std;void p( int divide, int v,int n, int a[]){ //打印所有划分情况,divide是最大划分数,v是数组 if( divide > n ) //下标,n是待划分数 divide = n; //最大划分数永远不大于被划分数 for( int i = divide; i >=1; i-- ){ if( n == i){ //一种划分情况完成,打印数组 a[v]=i; cout>n; while( n>n; } a=new int[n]; cout<<"一共有& 阅读全文
摘要:
/*4 52 31 23 42 2_____7*/#include#define MAX 1000using namespace std;int max(int n1, int n2){return n1>n2?n1:n2;}int dp[MAX][MAX], n, m, w[MAX], v[MAX];int rec(int i, int j){ if(dp[i][j]>=0) return dp[i][j]; int res; if(i==n){ res=0; }else if(j>n >> m; for(i=0; i>w[i] >>v[i]; 阅读全文