POJ1664(放苹果,感觉比较有意思)

#include<iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int counter(int x,int y) {
    if(y==1 || x==0) { return 1; }
    if(x<y) return  counter(x, x);
    return  counter(x,y-1) + counter(x-y,y);
}

int main()
{
    int t, m, n;
    cin>>t;
    for(int i=0; i<t; i++) {
        cin >> m >> n;
        cout << counter(m,n) << endl;
    }
    return 0;
}

你可能感兴趣的:(POJ1664(放苹果,感觉比较有意思))