Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
C语言也能行#include<stdio.h> int f(int i, int j, int max) { int k; int sum = 0; if( j==1 ) return 1; if( i==1 || i==0 ) return 1; k=i; if(max<i)k=max; for( ; k*j>=i; k--)//k值不能小于当前平均每个盘子中的苹果数 { sum = sum + f(i-k, j-1, k); } return sum; } main() { int t, m, n; scanf("%d",&t); while(t--) { scanf("%d%d",&m,&n); printf("%d\n",f(m,n, m+1)); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator