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. 【一天一道LeetCode】#10. Regular Expression Matching

    一天一道LeetCode系列 (一)题目 Implement regular expression matching with support for '.' and '*'. '.' Matches ...

  2. J2EE进阶(一)随堂笔记

    进公司搞研发,基本上用的都是J2EE框架.若想在公司混个不错的地位,首先技术上必须过关.由于需求所致,自己学习了J2EE一段时间,主要是Struts2,MyBatis(Hibernate的前身),远远 ...

  3. C语言字符串的常见特殊操作(除了string.c实现的那些接口)

    字符串操作中,必须掌握的一些之前已经在文章有写过了,比如说字符串查找,字符串粘帖,字符串拷贝等等,这些在标准C库的string.c中已经有实现,故包含#include <string.h> ...

  4. linux服务搭建----ssh服务开启

    //ssh  服务     ssh 192.168.88.254         如何开启   service sshd restart     关掉该服务 servicesshd stop     ...

  5. mysql随笔

    MySQL查询优化器--非SPJ的优化 MySQL查询优化器--非SPJ优化(一)--GROUPBY优化 http://blog.163.com/li_hx/blog/static/183991413 ...

  6. Hadoop DataNode不能正常工作的原因

    在把Hadoop环境搭建成功,并且也Hadoop的各个组件都正常工作.在重启过几次Hadoop后发现DataNode不能正常工作,打开Hadoop 的后台http://localhost:50030和 ...

  7. 总结:如何驱动DS18B20温度传感器

    DS18B20时序分析: 以下是STM32的驱动代码: #include "bsp_ds18b20.h" static void DS18B20_GPIO_Config(void) ...

  8. 演进之美,越来越美:三分钟看尽 iOS 1 ~ iOS 8 的进化史

    演进之美,越来越美:三分钟看尽 iOS 1 ~ iOS 8 的进化史 原文出处: 少数派 9 月 18 日苹果就将推出 iOS 8 正式版了,从 2007 年发布第一代 iPhone 时搭载在 iPh ...

  9. Django之ModelForm

    简介 Model + Form ==> ModelForm.model和form的结合体,所以有以下功能: 验证 数据库操作 Form回顾 models.py class UserType(mo ...

  10. java 中 printf()语句的理解

    对print和println的理解很简单,今天突然接触到printf(),有点懵,整理了下也帮自己理一理 printf是格式化输出的形式 下在举个例子: package other; public c ...