Friday, May 1, 2009

Problems of weights

we have some weights....all the wts are in the power of 3 (1,3,9,27,81,243...).Now the user will enter a wt and our task is to find that using which of the given wts we can get the entered wt...
example:wt entered by the user is 19kg
we can make 19 as....27-9+1
hence the output wil be 1,9,27
similarly for 62 81+9-27-1
hence output will be1,9,27,81

No comments: