[hackeroid] B1:4 Dragon Attack

The reversed action, conversion from decimal number system to arbitrary one we call Dragon Attack: Y_10->X_n. This conversion is usually done when we want to input information into the computer. We live in the decimal world, but computer -- in hexadecimal one. To input something into its world, "to attack", we have to convert this to alien number system.

Here one must be able to divide. :-) Let's translate numbers got during Dragon Taming back into "native" number systems, sequentially dividing them by their base until we get number which is less than the base itself. This number cannot be divided in columnar mode. :-)

   48 |  3              127797|  22
  -3  +-----+          -110   +------+
  --  |  16 |  3        ---   |  5808|  22
   18   -15 +----+       177    -44  +------+
  -18    -- |  5 |  3   -176     --  |  264 |  22
   --     1   -3 +----   ---     140   -22  +----
    0         -- |  1      197  -132    --  |  12=C
               2          -176   ---     44
                           ---    88    -44
                            21=L -88     --
                                  --      0
                                   0

The result is got from the last quotient and remainder, assembled in reverse order. So in the first case we get 1210_3 and in second -- C00L_22.

Try to convert numbers which you received during stand-alone practice of Taming back into their original number systems. Try to convert some decimal numbers into various strange number systems and back.

>>>

If you are able to divide in your head (or use an calculator), it is more convenient to use another kind of record:

   48|0  127797|21=L
   16|1    5808| 0
    5|2     264| 0
    1|       12=C

Here at every dividing the remainder is written to the right from the dash, and quotient -- below. As always, during attack the answer is received in the reverse order -- above from below.

Make the program producing the automatical conversion into any number system.

<<<

<<<B1:4 EOF>>>



E-mail: hscool@netclub.ru
Hosted by uCoz