分苹果
POJ-1664
1 #include <iostream> 2 3 using namespace std; 4 5 int solve(int n,int m){ 6 if(n==1 || n==0 || m==1) 7 return 1; 8 if (n<m){ 9 return solve(n, n); 10 } 11 else{ 12 return solve(n, m-1)+solve(n-m, m); 13 } 14 } 15 16 17 int main(int argc, char *argv[]) { 18 int times; 19 int n,m; 20 cin>>times; 21 while (times--) { 22 cin>>n>>m; 23 cout<<solve(n, m)<<endl; 24 } 25 }