#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int fun(int m,int n){ //抄的,我摊牌了-_- if(n==0||m==1){ return 1; }else if(n>m){ return fun(m,m); }else{ return fun(m-n,n)+fun(m,n-1); } } int main(){ int t,n,m; scanf("%d",&t); while(t--){ scanf("%d%d",&m,&n); printf("%d\n",fun(m,n)); } return 0; } |
Double click to view unformatted code.