Блог пользователя A.K.Goharshady

Автор A.K.Goharshady, 13 лет назад, По-английски
The code for converting decimal numbers to Roman was on Wikipedia , so I'm not going to explain it.
Since we have the upper limit 1015 for all of our numbers , we can first convert them to decimal (and store the answer in a 64-bit integer) and then to the target base.
For converting a number to decimal we first set the decimal variable to 0, then at each step we multiply it by the base and add the left-most digit's equivalent in base 10.
We had some tricky test cases for this one which got many people :
test #51:
2 10
0
many codes printed nothing for this one, this was also the most used hack for this problem

test #54:
12 2
000..00A
a sample of having initial zeros in input

test #55:
17 17
0000000...000
There were many people who just printed the input if bases were equal

there were two nice extremal hacks:
2 R
101110111000 
and
10 2
1000000000000000

Разбор задач Codeforces Beta Round 57 (Div. 2)
  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится