|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||256 MB||4||4||4||100.000%|
Julia and Jeremy are twins who like to set each other challenges. Both have been learning about number systems, and are aware that we normally use decimal (base 10) numbers, probably because of the number of fingers we have.
The twins decided it would be fun to convert our numbers to number systems that other creatures may use, creatures who have a different number of digits or other appendages. See if you can rise to their challenge!
Each challenge consists of 3 lines. The first line is a description of a creature (not necessarily real life). This will be no more than 20 characters in length. The final challenge begins with # - this challenge is not to be processed.
The second line of a challenge is the number of digits or appendages the twins assume the creature would use as a basis for its numbering system. This will be a number between 2 and 20 inclusive.
The final line is a decimal number which is to be converted into the assumed numbering system of the creature. This will be a positive integer no greater than 5,000
Each challenge requires a single line of output. It consists of the name of the creature, followed by a comma and a space, followed by the decimal number, followed by another comma and space, followed by the converted number. As is usual, where a base larger than 10 is used, upper case letters of the alphabet (A to J, in alphabetical order) are used as extra digits.
Three toed sloth 6 27 Octopus 8 126 Hexapus 16 397 #
Three toed sloth, 27, 43 Octopus, 126, 176 Hexapus, 397, 18D
Explanation for Hexapus
In decimal numbers, each place represents 10x the value of the place to its right, so 1,000s, 100s, 10s and 1s. 397 is 3 x 100 + 9 x 10 + 7. The hexapus (whatever one of those is!) uses 16 digits, 0 to 9 and A to F. With 16 digits, the places are 16x the value of the place to its right, so 3,364s, 256s, 16s and 1s.
18D for a hexapus is 1 x 256 + 8 x 16 + D (which is 13 in decimal) which is 256 + 128 + 13 which is 397 in decimal numbers. In the problem, you have to work backwards and convert 397 decimal to 18D.