Source: Insight (IITB Newsletter) Questech
In a land far away, there is a village threatened by an hundred-headed beast. This beast can only be killed by cutting of all the hundred heads. Legend says that any brave warrior can cut off exactly 10, 20, 30 or 40 heads at one time. However with each of these, 40, 2, 60 and 4 new heads appear respectively.
The village has lost several brave warriors against this beast. Can you save the village from this beast ?
Solution: Solution provided by Bhanu Prakash (M.Tech Student, CSE, IITB) in comments!!