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 ...
随机推荐
- event对象的clientX,offsetX,screenX,pageX
chrome: e.pageX——相对整个页面的坐标 e.layerX——相对当前坐标系的border左上角开始的坐标 e.offsetX——相对当前坐标系的border左上角开始的坐标 e.clie ...
- echarts和highcharts比较
echarts底层为canvas,highcharts底层为svg canvas特点: ①依赖分辨率 ②不支持事件处理器 ③弱的文本渲染能力 ④能够以.jpg..png格式保存结果图像 ⑤最适合图像密 ...
- zabbix3.4.7常用监控项
Zabbix中内置了很多监控参数(Key_),可以获取监控对象中的系统.CPU.网络.内存.文件系统等信息.下面就详细介绍一下这些监控参数的意义. 1. 测试获取监控参数内容的方法 在Zabbix S ...
- centos 安装composer
1 下载composer.phar curl -sS https://getcomposer.org/installer | php 2 设置全局调用 mv composer.phar /usr/lo ...
- cerebro 配置
cerebro 是 elastic search 的 监控平台 # Authentication auth = { type: ldap settings: { url = "ldap:// ...
- 论坛短信息(JSP项目)
if("list".equals(action)){ String username = request.getSession().getAttribute("login ...
- Windows平台下不同版本SVN对比
(1)SVN服务端subversion与SVN客户端tortoiseSVN (2)subversion服务器程序在windows下共有5个下载版本,分别是:Collabnet , SlikSVN , ...
- scrapy中crawlspide中callback和follow函数的作用及使用方法
Rule(LinkExtractor(allow=r'i/tems'),callback='parse_item',follow=True) 当前代码的含义就是将当前页面及按照allow=r'i/t ...
- Tex_Err:缺失wlscirep.cls
使用期刊模板编译时,需要'.cls'一类格式文件支持.从Overleaf上直接Copy代码到本地,发现自己的tex运行时会报错: ! LaTeX Error: File `wlscirep.cls' ...
- element-ui Select 清空model,页面没有清空选中项的问题
业务场景: 在dialog 每次打开时, 选择应用程序要初始化为空. 最初的做法为: 监听dialog的show状态,当show为false时,设置selectApp为空这样写时,虽然selectAp ...