#include
using namespace std;
#define ll long long int
ll tiling(ll n,ll m)
{
if(m>n)
{
return 1;
}
if(m==n)
{
return 2;
}
ll c1=tiling(n-1);
ll c2=tiling(n-m);
return (c1+c2)%1000000007;
}
int main() {
ll t;
cin>>t;
while(t>0)
{
ll n;
ll m;
cin>>n>>m;
cout<<tiling(n,m)<<endl;
t–;
}
return 0;
}
I AM GETTING COMPILATION ERROR
Tiling 2 RECURSION
This problem contains the overlapping subproblems, so can only be solved using 1-d dynamic programming logic, so I would advise you to first go through the online lectures on dynamic programming and then try to solve this problem…
Since, you arent replying anything, I am marking this doubt as resolved, You can reopen it if you still face any issues….