Main
  About Cybernetics
  Olympiad Regulations
  Olympiad History
 
  • Photo
  • Video



  •   Examples of Tasks
      Organizing Committee
      Current Olympiad
     
  • Teams Registration
  • Participants
  • Olympiad Results

  • Login:

    Password:

     
     RUS / ENG
        News
     
    Task 2008-1. "The idler on a bazaar"

    For goods weighing k weights are used, nominals of weights are k serial degrees of a twain, since 20 = 1 and ending 2k-1, i.e. 20, 21, 22, …, 2k-1 gramme.

    Task. What minimum number of the weights necessary for weighing of the goods of the set weight?

    Notes. Goods weight in grammes – an integer. At weight weighing it is possible to put on both cups of scales. For example: for weighing of the goods in weight 15g it is possible to put on one cup of scales the goods, and on another – a combination of weights 1 + 2 + 4 + 8. But an optimal way – to add weight in 1g to the goods, and to put 16g on other cup. As a result it is necessary only 2 weights.

    Stream. The input stream sets number of weights k and goods weight. The output stream should specify the minimum number of weights, or -1 if weighing is impossible.

    Example
    Input stream:
    5 15
    Output stream:
    2

     
       
    19.02.2013 17:19
     
    Cyber XIV. Results of Distance Session of Olympiad . . . -->

    21.01.2013 15:59
     
    Key for a training session . . . -->

    29.02.2012 12:41
     
    Video of the Olympiad . . . -->

    29.02.2012 12:12
     
    The results of Main Session of Olympiad on Cybernetics . . . -->

    News archive
     
    Back to news archive -->


    Today visitings: 391
    All visitings: 830027
    Web ststistics: