getting WA in cook94B 2nd question

Getting WA in cook94B question Best Cake Ever
Ques: https://www.codechef.com/COOK94B/problems/KMXOR
my soln : https://www.codechef.com/viewsolution/18620651
Any test case will help…:slight_smile:

N=5,k=6

Your code outputs:6 1 1 1 1

We can have:4 2 1 1 1

try : 3 23

your code gives maximum of 30 but it can be 31 (1 9 23)

In your code try changing the part where you greedily setting all the previous value to ‘1’ if n is odd

thnx a lot :slight_smile:

got the point thnx Buddy :slight_smile: