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 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 Specification:
Each input file contains one test case which occupies a line containing the three decimal color values.
Output Specification:
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 its left.
Sample Input:
15 43 71
Sample Output:
#123456
- #include<iostream>
- using namespace std;
- char num[] = {'','','','','','','','','','','A','B','C'};
- void deal(int oct)
- {
- cout<<num[oct/]<<num[oct%];
- }
- int main()
- {
- int R,G,B;
- cin>>R>>G>>B;
- cout<<'#';
- deal(R);
- deal(G);
- deal(B);
- return ;
- }
PAT 甲级 1027 Colors in Mars (20 分)的更多相关文章
- PAT 甲级 1027 Colors in Mars (20 分)(简单,进制转换)
1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way ...
- PAT Advanced 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642
PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642 题目描述: People in Mars represent the c ...
- PAT甲级——1027 Colors in Mars
1027 Colors in Mars People in Mars represent the colors in their computers in a similar way as the E ...
- 【PAT甲级】1027 Colors in Mars (20 分)
题意: 输入三个范围为0~168的整数,将它们从十三进制转化为十进制然后前缀#输出. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include& ...
- PAT (Advanced Level) Practice 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- PAT 甲级 1027 Colors in Mars
https://pintia.cn/problem-sets/994805342720868352/problems/994805470349344768 People in Mars represe ...
- 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- PAT甲级:1152 Google Recruitment (20分)
PAT甲级:1152 Google Recruitment (20分) 题干 In July 2004, Google posted on a giant billboard along Highwa ...
随机推荐
- js 前端 table 导出 excel
园子,github,stackoverflow 关于前端下载的文章不少 园子里大部分都是 利用ActiveXObject对象来实现,可他有个缺点安全等级,还有必须安装excel…… github,st ...
- kafka consumer 指定 offset,进行消息回溯
kafka consumer 如何根据 offset,进行消息回溯?下面的文档给出了 demo: https://cwiki.apache.org/confluence/display/KAFKA/0 ...
- ceph Luminous版手动安装零散记录
1.安装必要的依赖包,关防火墙,向/etc/hosts内添加域名等 2.安装ceph 配置yum源 (如果嫌慢,可以配置cachedir=/home/yum/$basearch/$releasever ...
- SpringMVC 搭建遇到的坑
1. Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 60; cvc-complex-type.2.4.c ...
- 禁止WORDPRESS站内搜索的方法
如果我们希望禁止站内搜索,毕竟会是的MYSQL负担加重,我们可以禁止掉,然后在使用第三方搜索组件.比如用百度站内搜索或者360站内搜索. function fb_filter_query( $quer ...
- bootstrap--------bootstrap table
bootstrap table 显示行号 <th rowspan="2" data-field="index" data-formatter=" ...
- java集合之List。
实际上有两种List:一种是基本的ArrayList其优点在于随机访问元素,另一种是更强大的LinkedList它并不是为快速随机访问设计的,而是具有一套更通用的方法. List:次序是List最重要 ...
- SVN创建分支/合并分支/切换分支
在建立项目版本库时,可首先建好项目文件夹,并在其中建立trunk, branches, tags三个空的子目录.这样在trunk中开始进行开发 trunk是主分支,是日常开发进行的地方. branch ...
- 01_Mybaits逆向工程maven版
1.创建generatorSqlmapCustom工程 2.修改pom文件 <?xml version="1.0" encoding="UTF-8"?&g ...
- Dilated Convolutions 空洞卷积
Dilated Convolutions,中文一般称为空洞卷积或者扩张卷积,是一种改进的图像卷积方法. 扩张卷积工作示意图如下: 图a是普通的卷积,感受野是3*3,相当于扩充dilation=0 图b ...