Sunday, August 15, 2010

UVa 619 Numerically Speaking

Problem: lexicographically number all words. Translation from both side is required.

Size: Not specified, but output is limited to words with 22 alphabets.

Solution: use big integers. Note that there is no zero in alphabets, each char must add 1 while changing base. For example, word zz = 26*26 + 26 = (25+1)*26^1 + (25+1)*26^0.

No comments: