#include<bits/stdc++.h>
using namespace std;
void compute(int n,string s,int &ans){
if(n==0){
ans++;
return;
}
if(n<0)
return;
compute(n-1,βaβ+s,ans);
int x=s.length();
if(s[x-1]!=βbβ)
compute(n-1,βbβ+s,ans);
return;
}
int main(){
int t;
cin>>t;
int i=1;
while(tβ){
int n;
cin>>n;
int count=0;
compute(n,"",count);
cout<<"#"<<i++<<" : "<<count<<endl;
}
return 0;
}
What is the error in this
hey @manikanand4 your code isnβt readable here
You can share this code using ide.codingblocks.com
- go to ide.codingblocks.com
- Save your code here
- A special url will be generated, share that url with me
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.