What is wrong with the solution

i tried in editor not accepting any input

https://ide.codingblocks.com/s/229342

@saxena.anukrati15
there are few mistake in your code.

  1. see in line 30, you are iterating your loop till i<t, but your t already become zero because of above while loop. So after line 5, make another variable say int tc=t. and change your condition to i<tc.
  2. int j variable should be declared outside do while loop. here for each testcase you are just updating ans[0] since everytime j starts with j=0.
  3. line 32 should be cout<<ans[i]<<endl; not ans[t]

@saxena.anukrati15
As I can see you got 100 points. Please mark it as resolved.

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.