Stick the Sticks
All submissions for this problem are available.
This is the algorithmic version of a game that kids play in our part of the country. You will be provided with a few sticks. The length of the sticks will be in the order of powers of 2. (1,2,4,8,16,32....). You will also be given another test stick of any length. The task is to write a program that finds the minimum number of sticks required to make the required test stick.
A positive integer in the range 1 to 10000
A positive integer denoting the minimum number of sticks
Input: 5 Output: 2
|Time Limit:||0.207589 - 3.2811 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.