摘要: View Code 1 #include<iostream> 2 using namespace std; 3 4 int divs(int m,int n) 5 { 6 if(m<0)return 0; 7 if(m == 0 || n==1)return 1; 8 return divs(m-n,n) + divs(m,n-1); 9 // 可以归纳为两种情况: 10 //divs(m-n,n) 表示 每个盘子中至少一个苹果 ,则剩下的 m - n个 可以 随意 向 n个盘子中放11 //divs(m,n-1) 表示 至少一个盘子 没有苹果 则 m... 阅读全文
posted @ 2012-04-01 19:24 知行执行 阅读(165) 评论(0) 推荐(0) 编辑
摘要: View Code 1 2 #include<iostream> 3 #include<algorithm> 4 using namespace std; 5 6 struct node 7 { 8 int x; 9 int f;10 int c;11 }a[101];12 13 bool cmp(node x,node y)14 {15 return x.c<y.c;16 }17 18 int main()19 {20 int i,j;21 int K,E,N;22 int m;23 cin>>m;24 for(i = 0;i<m... 阅读全文
posted @ 2012-04-01 13:40 知行执行 阅读(160) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<iostream.h> 3 4 int divs(int m,int n) 5 { 6 if(n==1)return 1; 7 if(m == n)return 1; 8 if(m < n)return 0; 9 if(m>n)return divs(m-1,n-1) + divs(m-n,n);//divs(m-1,n-1)代表是第一位放 1 剩余的10 //m - 1位再在其余 n-1 位上分11 //divs(m-n,n)代表的是每一位上放的数字都大于112 //m .. 阅读全文
posted @ 2012-04-01 13:39 知行执行 阅读(211) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<iostream> 2 using namespace std; 3 4 int divs(int m,int n) 5 { 6 if(m<1 || n<1)return 0; 7 if(m == 1 || n==1)return 1; 8 if(m<n)return divs(m,m); 9 if(m == n)return divs(m,m-1) + 1;10 return divs(m,n-1) + divs(m-n,n);11 }12 13 int main()14 {15 int t,n;16 cin>&g 阅读全文
posted @ 2012-04-01 13:38 知行执行 阅读(159) 评论(0) 推荐(0) 编辑