1027. Colors in Mars (20)

时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue

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.

Input

Each input file contains one test case which occupies a line containing the three decimal color values.

Output

For each test case you should output the Mars RGB value in the following format: first output "#", then followed by a 6-digit number where all the English characters must be upper-cased. If a single color is only 1-digit long, you must print a "0" to the left.

Sample Input

15 43 71

Sample Output

#123456

思路
很简单的10进制数转换为13进制数问题
代码
#include<iostream>
using namespace std;
char a[] = "0123456789ABC";
int main()
{
int colors[];
while(cin >> colors[] >> colors[] >> colors[])
{
cout <<"#";
for(int i = ;i < ;i++)
{
cout << a[colors[i]/] << a[colors[i] % ];
}
cout << endl;
}
}
 

PAT1027:Colors In Mars的更多相关文章

  1. PAT1027 Colors in Mars (20分) 10进制转13进制

    题目 People in Mars represent the colors in their computers in a similar way as the Earth people. That ...

  2. PAT1027. Colors in Mars (20)

    #include <iostream> using namespace std; string tbl="0123456789ABC"; int main() { in ...

  3. PAT 甲级 1027 Colors in Mars (20 分)

    1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way a ...

  4. PAT 1027 Colors in Mars

    1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way ...

  5. PAT 1027 Colors in Mars[简单][注意]

    1027 Colors in Mars (20)(20 分) People in Mars represent the colors in their computers in a similar w ...

  6. 1027 Colors in Mars (20 分)

    1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way a ...

  7. PTA (Advanced Level) 1027 Colors in Mars

    Colors in Mars People in Mars represent the colors in their computers in a similar way as the Earth ...

  8. A1027 Colors in Mars (20)(20 分)

    A1027 Colors in Mars (20)(20 分) People in Mars represent the colors in their computers in a similar ...

  9. pat 1027 Colors in Mars(20 分)

    1027 Colors in Mars(20 分) People in Mars represent the colors in their computers in a similar way as ...

随机推荐

  1. Android调试工具之ADB

    Android调试工具之ADB 1.     什么是ADB adb的全称为Android Debug Bridge,顾名思义,这个是PC机与Android设备的连接桥.简单的说,就是通过adb ,PC ...

  2. 如何成为Android高手

    要成为Android 高手并不是一件容易的事情.并不是很多人想象的 能够飞快的写出几行漂亮的代码去解决一些困难的问题 就是Android 高手了.真正的Android 高手需要考虑的问题远远不是写些漂 ...

  3. 2015/12/24:嵌入式C语言的位操作随笔

    今晚是平安夜,首先祝大家平安夜快乐,明天是圣诞,祝大家圣诞快乐!!        好了,这周都特别有空,上班也非常轻松,基本就是看看内核驱动,学学安卓,没什么正事的开发活干.今晚,我们来总结一例在现实 ...

  4. zTree的调用设使用(跨两个系统,两类技术实现的项目案例SpringMVC+Spring+MyBatis和Struts2+Spring+ibatis框架组合)

    1.从zTree官网上下载zTree的包,zTree的官方网址是:http://www.ztree.me/v3/main.php#_zTreeInfo 2.引入zTree所需的依赖,例如(jQuery ...

  5. 虚拟机安装Ubuntu14.04打开FireFox提示Server not found

    虚拟机安装Ubuntu14.04打开FireFox提示Server not found 我采用VMware安装ubuntu14.04的,VMware的网络是配置采用NAT模式(用于共享主机的IP地址) ...

  6. 打开Visual Studio 2010,左下角显示正在从包...加载工具箱内容,卡住5、6秒!!!

    在VS2010命令提示符用 devenv /ResetSkipPkgs 或者 devenv /ResetSettings

  7. Linux常用命令(第二版) --帮助命令

    帮助命令 1.man[manual]: /usr/bin/man 获得命令或配置文件的帮助文档,优先查看命令的帮助 格式:man [命令或配置文件]  #会同时调用more E.g. man ls # ...

  8. Oracle技术面试问题

    这也许是你一直期待的文章,在关注这部分技术问题的同时,请务必阅读有关面试中有关个人的问题和解答.这里的回答并不是十分全面,这些问题可以通过多个 角度来进行解释,也许你不必在面试过程中给出完全详尽的答案 ...

  9. spring 配置多数据源(mysql读写分离)

    前段时间刚换了家新公司,然后看项目代码里用了数据库读写分离的架构,然后好奇扒了代码简单看了下,总体来说就是运用spring aop切面方式来实现的.看明白后就在自己的个人小项目里运用了下,测试OK,所 ...

  10. Spring AOP四种实现方式Demo详解与相关知识探究

    一.前言 在网络上看到一篇博客Spring实现AOP的4种方式,博主写的很通俗易懂,但排版实在抓狂,对于我这么一个对排版.代码格式有强迫症的人来说,实在是不能忍受~~~~(>_<)~~~~ ...