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. Tomcat7调优及JVM性能优化for Linux环境

    标签: tomcat7 jvm 性能 分享到: 出处:http://www.iteye.com 该优化针对Linux X86_X64环境 1. Tomcat优化其实就是对server.xml优化(开户 ...

  2. robotframework代码定位感悟

    robotframework代码定位感悟: 在做自动化的时候,有时候还是要考虑真实的操作,考虑人为反应,网络,页面渲染,服务器处理请求的过程及数据是否真实到达响应的位置, 不能一味的按照程序的速度 去 ...

  3. npm常用指令

    安装: npm install <name> npm install <name> 安装依赖包,默认安装最新版本,也可在后面加上版本号,并且将安装信息加入项目的package. ...

  4. PAT (Top Level) Practise 1005 Programming Pattern (35)

    后缀数组.排序之后得到height数组,然后从上到下将height>=len的都分为一组,然后找到第一组个数最多的输出即可. #pragma comment(linker, "/STA ...

  5. php错误记录

    1.模板不存在ThinkPHP\Library\Think\View.class.php LINE: 110 是因为IndexController的Index函数,而View中没有对应的Index文件 ...

  6. MFC实现登录对话框连接access数据库方式

    编写一个简单的登录对话框 大家好,我们利用MFC编写一个简单的登录对话框.主窗体是单文档界面.程序运行的时候,先弹出一个简单的登录对话框,输入用户名和密码后主窗体显示出来. 1.开打VC++6.0.点 ...

  7. JAVA序列化与反序列化三种格式存取(默认格式、XML格式、JSON格式)

    什么是序列化 java中的序列化(serialization)机制能够将一个实例对象的状态信息写入到一个字节流中,使其可以通过socket进行传输.或者持久化存储到数据库或文件系统中:然后在需要的时候 ...

  8. java 线程池 并行 执行

    https://github.com/donaldlee2008/JerryMultiThread/blob/master/src/com/jerry/threadpool/ThreadPoolTes ...

  9. simHash 简介以及java实现

    http://gemantic.iteye.com/blog/1701101 simHash 简介以及java实现 博客分类: 算法 simHash java 去重  传统的hash 算法只负责将原始 ...

  10. web前端与后端

    Web前端:     1)精通HTML,能够书写语义合理,结构清晰,易维护的HTML结构.     2)精通CSS,能够还原视觉设计,并兼容业界承认的主流浏览器.     3)熟悉JavaScript ...