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

就是,一种颜色用6位数字表示,前两位表示红色,中间两位表示绿色,最后两位表示蓝色。

Blue. The only difference is that they use radix 13 (0-9 and A-C) instead of 16.

只有一点不同就是在,他们使用的是13进制取代了我们的16进制。

Now given a color in three decimal numbers (each between 0 and 168), you are supposed to output their Mars RGB values.

现在给出一个颜色的三个十进制数。每个数字从0-168,你需要输出他们的火星RGB值。

Input

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

输入案例:每个输入文件包含一个测试案例,包含一行,3个十进制颜色值。

Output

For each test case you should output the Mars RGB value in the following format:

对于每一个输出样例,你应该输出一个火星的RGB值,并符合以下的形式:

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.

先输出一个“#”,然后接着输出6位数字,所有的英文字符必须大写。如果只有一个颜色只有一个数字,必须左边加0表示。

Sample Input

15 43 71

Sample Output

#123456
 
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm> using namespace std; char a[]={
'','','','','','','','','','','A','B','C'
}; int main()
{
int r,g,b;
cin>>r>>g>>b;
cout<<"#"<<a[r/]<<a[r%]<<a[g/]<<a[g%]<<a[b/]<<a[b%]<<endl;
return ;
}

代码简练一些,我觉得这样已经可以算是简练了,很简单的一道题目,学习一下英语吧

PAT1027的更多相关文章

  1. PAT1027:Colors In Mars

    1027. Colors in Mars (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue People ...

  2. PAT1027. Colors in Mars (20)

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

  3. 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 ...

随机推荐

  1. SQL函数学习(三):convert()函数

    格式:CONVERT(data_type,expression[,style])说明:此样式一般在时间类型(datetime,smalldatetime)与字符串类型(nchar,nvarchar,c ...

  2. redis的主从复制与哨兵

    主从复制的关键字是slaveof,有三种方法可以让一个redis数据库变成另一个redis数据库的从数据库: 1.修改redis的配置文件,添加#slaveof <masterip> &l ...

  3. 用xftp传送避免乱码问题

    用xftp传送文件时,需要输入ip地址,可连通的端口号,采用sftp协议 输入数据库传送,属性binary,二进制 上传文件,图片中文名称正常显示等,需要该属性支持UTF-8

  4. over 分析函数之 lag() lead()

    /*语法*/ lag(exp_str,offset,defval) over()  取前 Lead(exp_str,offset,defval) over()  取后 --exp_str要取的列 -- ...

  5. android:layout_weight属性的使用方法总结

    原创文章,转载请注明出处http://www.cnblogs.com/baipengzhan/p/6282826.html android:layout_weight属性可以和其他属性配合使用,产生多 ...

  6. Chapter 2 Open Book——3

    But when I walked into the cafeteria with Jessica — 但是当我和Jessica 一起走进自助餐厅的时候 trying to keep my eyes ...

  7. JavaScript在智能手机上的应用-使用手机GPS定位用户所在城市

    ---------------------------- <script type="text/javascript" language="javascript&q ...

  8. js 时间

    <html> <head> <meta charset="utf-8" /> <title></title> <s ...

  9. Linux系统手动安装rpm包依赖关系分析(以Kernel升级为例)

    有在Linux系统中安装软件的经历的人都知道,在Linux系统中手动安装软件不想在Windows下安装软件那么方便,直接双击,然后下一步下一步就可以把软件成功的装入到系统中,而在Linux系统中,安装 ...

  10. APUE读书笔记:进程控制

    重点函数:fork,exit,_exit 一.fork 函数原型: #include <unistd.> pid_t fork(void) 函数说明:fork函数将创建一个子进程,该函数调 ...