#include<iostream> using namespace std; int solve(int m,int n){ if(n==1||m==1||n==0) return 1; if(m<n) return solve(m,m); else return solve(m,n-1)+solve(m-n,n); } int main(){ int t,m,n; cin>>t; while(t--){ cin>>m>>n; cout<<solve(m,n)<<endl; } }
思路来自于CSDN博客,原作者忘记了