A Squirrel has to transport nuts from location A to location B. The distance between two locations is “X” kms. The Squirrel will consume one nut for every 1 km it travels. The Squirrel can carry at max “Y” nuts at a given time. If there are “Z” nuts at location A, what is the maximum number of nuts that can be transported to location B.
Write a program to calculate the maximum number of nuts that a Squirrel can transport - given X,Y & Z
Total distance – X
Total nuts that a Squirrel can carry – y
Total nuts available at location - Z
String (X, Y, Z) 200, 200, 600
Given 600 nuts, Squirrel can carry a maximum of 200 nuts at a time. The total distance to cover is 200. To start with if a Squirrel takes 200 nuts and walks 200 kms, it will not be left with any nuts at the end of 200 kms, since it consumes 1 nut per km.
Note 50 is not the best possible answer