Class Assignment problem

Hi , I tried to solve the class assignment problem in the same way as we try to solve the no of binary strings with no consecutive 1’s problem . The sample test case is running absolutely fine but in the final submission , no test case is passing . Please help me in solving the problem

CHeck now -> concept of dp + outptu nformat was required rest everything was correct.

Thanks a lot for clearing the doubt

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.

Hi Encoder , the code you sent is still not passing any test case .There was 1 error , where in you did cout<<i rather than cout<<num (where i was the current no of test case , it should have been number ) .I corrected that line and copied the code you had made but still no test case is passing .Please help me to figure out the mistake

Hello @imsharan0105 you have raised the doubt again tell me now what is the problem you are facing?

No test case is passing in the final answer and I am unable to debug the error in my code .I had changed the output format as well as used dp as was told previously by the person who resolved my doubt but still no test case is passing .

Here is the code that i wrote

@imsharan0105 check this https://ide.codingblocks.com/s/425395
i have commented the mistake:

Thanks , it works fine now

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.