Frugal selection of weights to weigh a thing

1,443.0K Views
Answered

You are given a balance (that is, a weighing machine with two trays) and a positive integer N.  You are then to request a number of weights.  You pick which denominations of weights you want and how many of each you want.  After you receive the weights you requested, you are given a thing whose weight is an integer between 1 and N, inclusive.  Using the balance and the weights you requested, you must now determine the exact weight of the thing.

As a function of N, how few weights can you get by requesting?

Share
Add Comment

  • 1 Answer(s)
    Best answer

    Finding Highest value of x such that 3^x is less than n.
    Then,
    We will take every value fro 0 to x and we will get our  values we have to put in 3^x to get our weights. After adding every weight if n is still greater then I will request one more weight that will be 3^(x+1).

    Yodha Expert Answered on 12th February 2016.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.
  • More puzzles to try-