PAT 解题报告 1027. Colors in Mars (20)


求火星上的颜色的RGB值, 定义如下:

People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and the last 2 digits for Blue. The only difference is that they use radix 13 (0-9 and A-C) instead of 16. Now given a color in three decimal numbers (each between 0 and 168), you are supposed to output their Mars RGB values.


考察的是简单的进制转换, 把一个十进制的数字转换成13进制的, 利用取模数就能完成了.



Written on August 1, 2013