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 ...
随机推荐
- Mac OS 下安装nvm
关于安装: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh 安装完成后关闭终端,重新打开终端输 ...
- UPX脱壳全程分析(转)
[文章标题]: UPX脱壳全程分析 [保护方式]: 本地验证 [使用工具]: OllyDBG [作者声明]: 只是感兴趣,没有其他目的.失误之处敬请诸位大侠赐教! ------------------ ...
- 一个简单的CD/CI流程思考,续
经过各种优化,最终一个非常简单的pipeline出现了,图中没有包含单元测试及静态代码检查的部分,有时间补上.至少实现了提交即构建,也能迅速反馈给开发者. 但是最大的问题是,研发团队还是习惯依赖于部署 ...
- PAMIE模块安装
PAMIE2.0适用于python2.0.x,PAMIE3.0适用于python3.0.x. 这里记录安装PAMIE2.0方法: 一.安装PAMIE2.0 1.下载PAMIE20压缩包:https:/ ...
- Android设备终端监控可能用到的工具
先记录工具,以后详细分析 add-property-tagcheck-lost+foundcpueatercpustatsdaemonizedexdumpdirectiotestfiokexecloa ...
- MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example 1.4 Labeling the Map
MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example 1.4 Labeling the Map 一.前言 MapServer拥有非常灵活的标签 ...
- Spring Boot + Spring Cloud 实现权限管理系统 权限控制(Shiro 注解)
技术背景 当前,我们基于导航菜单的显示和操作按钮的禁用状态,实现了页面可见性和操作可用性的权限验证,或者叫访问控制.但这仅限于页面的显示和操作,我们的后台接口还是没有进行权限的验证,只要知道了后台的接 ...
- 如何使用 Excel 对象将 DataGridView 数据导出到 Excel
转载出处:https://code.msdn.microsoft.com/How-to-insert-image-into-93964561 本项目阐述如何使用 Open XML SDK 将图像插入到 ...
- Jmeter的Body Data里输入中文时乱码
apache-jmeter-3.0\bin目录下, 用Notepad工具打开jmeter.properties文件 把#jsyntaxtextarea.font.family=Hack的前面的#号去掉 ...
- (转)Web.config配置文件详解
花了点时间整理了一下ASP.NET Web.config配置文件的基本使用方法.很适合新手参看,由于Web.config在使用很灵活,可以自定义一些节点.所以这里只介绍一些比较常用的节点. <? ...