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. Linux下的tree命令 --Linux下目录树查看

    Linux下的tree命令 --Linux下目录树查看 有时我们需要生成目录树结构,可以使用的有ls -R,但是实际效果并不好 这时需要用到tree命令,但是大部分Linux系统是默认不安装该命令的, ...

  2. 谈谈java中的线程(初级概念)

    定义 关于进程与线程的定义 可参看一下这个介绍 http://www.ruanyifeng.com/blog/2013/04/processes_and_threads.html 在不细抠定义的情况下 ...

  3. java工具类(六)根据经纬度计算距离

    Java实现根据经纬度计算距离 在项目开发过程中,需要根据两地经纬度坐标计算两地间距离,所用的工具类如下: Demo1: public static double getDistatce(double ...

  4. mysql进阶(十三)命令行导出导入数据库

    MySQL命令行导出导入数据库 MySQL命令行导出数据库: 1,进入MySQL目录下的bin文件夹:cd MySQL中到bin文件夹的目录 如我输入的命令行:cd D:\Program Files\ ...

  5. android Titlebar一行代码实现沉浸式效果

    github地址 一个简单易用的导航栏TitleBar,可以轻松实现IOS导航栏的各种效果  整个代码全部集中在TitleBar.java中,所有控件都动态生成,动态布局.不需要引用任何资源文件,拷贝 ...

  6. adb shell后出现error解决方案

    解决办法: 解决办法: 1.adb kill-server 2.adb start-server 3.adb remount 4.adb shell 一般情况下都可以在此启动adb相关

  7. 单片机PWM调制技术

    我们可以看看下图,下图就是一个典型的PWM的波形图. T是一个周期,T1就是高电平所占用的时间,T2就是低电平所占用的时间. 如上图所示T1为脉冲宽度(就是导通时间),周期为T,则输出电压的平均值为U ...

  8. rails4 new没有生成prototype.js之类的脚本解决办法

    早期版本的rails在新生成程序时会在/public/javascript目录中自动放入若干个js脚本.不过在rails4.2.0中无论是否加-j选项,都不会生成这些脚本文件了.解决办法是安装prot ...

  9. 将文件内容转化为byte数组返回

    如何将文件内容转化为byte数组并返回呢?对于这个问题,我献上我第一次成功的代码~ package com.succez.task1; import java.io.ByteArrayOutputSt ...

  10. J2SE-程序执行与内存图

    全局程序运行内存图 基础数据类型:byte,short,int,long(整数) float,double(浮点)   -- 数值 char                               ...