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. 打包volley

    1.如果电脑没有安装git和ant的话,需要安装git和ant,直接Google就可以,并配置环境变量 2.在命令行执行 git clone https://android.googlesource. ...

  2. STL常用排序算法介绍

    merge()  以下是排序和通用算法:提供元素排序策略  merge: 合并两个有序序列,存放到另一个序列. #include <iostream> #include <cstdi ...

  3. Linux常用命令(第二版) --系统开关机命令

    系统开关机命令 说明-服务器不会经常的关机,重启,没有故障,服务器不会关机.因此这些命令就显得不是很常用. 1.shutdown /usr/sbin/shutdown e.g. shutdown -h ...

  4. Swift必备开发库(高级篇)

    1.CryptoSwift swift加密库, 支持md5,sha1,sha224,sha256... github地址: https://github.com/krzyzanowskim/Crypt ...

  5. Android ROM开发(二)——ROM架构以及Updater-Script脚本分析,常见的Status错误解决办法

    Android ROM开发(二)--ROM架构以及Updater-Script脚本分析,常见的Status错误解决办法 怪自己二了,写好的不小心弄没了,现在只好重新写一些了,上篇简单的配置了一下环境, ...

  6. iOS在GitHub Top 前100 简介

    主要对当前 GitHub 排名前 100 的项目做一个简单的简介, 方便初学者快速了解到当前 Objective-C 在 GitHub 的情况. 项目名称 项目信息 1. AFNetworking 作 ...

  7. linux下如何查询未知库所依赖的包

    经常会遇到linux下安装软件时提示少文件,如何知道所缺少的文件属于哪个包?用什么命令查看? 例如:/lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录 ...

  8. svn 不能添加.a文件

    1.打开终端输入    open ~/.subversion/ 2.双击打开config文件 3.修改如下两行 # global-ignores = *.o *.lo *.la *.al .libs ...

  9. Web服务器Tomcat集群与负载均衡技术

    我们曾经介绍过三种Tomcat集群方式的优缺点分析.本文将介绍Tomcat集群与负载均衡技术具体实施过程. 在进入集群系统架构探讨之前,先定义一些专门术语: 1. 集群(Cluster):是一组独立的 ...

  10. Tracert(跟踪路由)是路由跟踪实用程序,用于确定 IP 数据包访问目标所采取的路径。

    Tracert(跟踪路由)是路由跟踪实用程序,用于确定 IP 数据包访问目标所采取的路径.   Tracert 命令用 IP 生存时间 (TTL) 字段和 ICMP 错误消息来确定从一个主机到网络上其 ...