Task 3: Cave Troll

Go down

Task 3: Cave Troll

Post  Admin on Sat Jun 04, 2011 10:44 am

In Trollville, trolls live happily. These trolls are different from your average forum trolls, these are CAVE trolls. Cave trolls need food to live. In the middle of Trollville there is a 1 metre tree which produces food every day based on its size. More precisely, the tree will hold 1kg of food for each metre in height. The tree doubles in height every day. The trolls want to have a feast which needs a certain amount food, so they won't eat anything from the treee until they have enough. Make a program that calculates the number of days the trolls have to wait to have enough food.

Example:
Input:
Food required (kg): 5
Output:
3

Input:
Food Required (kg) 1025
Output:
11

Admin
Admin

Posts : 21
Join date : 2011-06-04

View user profile http://nsbcoder.board-directory.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum