题解 | #放苹果#
放苹果
http://www.nowcoder.com/practice/bfd8234bb5e84be0b493656e390bdebf
#include<iostream>
using namespace std;
int nums = 0;
void methods(int a, int b){
if (a<b) b=a;
if (a==0||a==1||b==1){
nums++;
return;
}
for (int i=1;i<=b;i++) methods(a-i,i);
return;
}
int main(){
int m,n;
while(cin>>m>>n){
methods(m,n);
cout<<nums<<endl;
nums = 0;
}
return 0;
}