poj 1664(水题,找规律,空盘子很重要)


#include
using namespace std;
int f(int M,int N){
    if(M==0||N==1){
        return 1;
    }
    if(M<N){
        return f(M,M);
    }
    return f(M,N-1)+f(M-N,N);
}
int main(){
    int n,M,N;
    scanf("%d",&n);
    while(n--){
        scanf("%d%d",&M,&N);
        printf("%d\n",f(M,N));
    }
    return 0;
} 

相关