Mr. Snake

Limits: 500ms, 256 MB

Mr Snake has a strange growing ability. Suppose, his length is X units. If he eats X magic fruits, then his body length increases by Y units so that his new total body length becomes (X+Y) units. Mr Snake is teased by his friends because of his short length. So, he wants to become Z units long. However, he can not figure out how many magic fruits he needs to eat. Can you help Him?

This is a companion discussion topic for the original entry at