How to solve- A puzzle game problem code: H1

h1

#1

Please guide in this question on how to solve. Problem Link- https://www.codechef.com/problems/H1


#2

i found this might help you
link text