题解 | #放苹果#
放苹果
http://www.nowcoder.com/practice/bfd8234bb5e84be0b493656e390bdebf
include<bits/stdc++.h>
using namespace std;
int fun(int m,int n){
    if(m<0 || n<=0) return 0;
    if(m==1 || n==1 || m==0) return 1;
    return fun(m,n-1)+fun(m-n,n);
}
int main()
{
    int m,n;
    while(cin>>m>>n){
        cout<<fun(m,n)<<endl;
    }
}
动态规划可以根据题意去想,这里m==0也是一种策略。
 阿里巴巴灵犀互娱公司福利 659人发布
阿里巴巴灵犀互娱公司福利 659人发布