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 ...
随机推荐
- 微信小程序城市定位(百度地图API)
概述 微信小程序提供一些API(地址)用于获取当前用户的地理位置等信息,但无论是wx.getLocation,还是wx.chooseLocation均没有单独的字段表示国家与城市信息,仅有经纬度信息. ...
- unity中 UGUI的按下、拖动接口事件的实现
using UnityEngine; using System.Collections.Generic; using DG.Tweening; using UnityEngine.EventSyste ...
- 为什么企业需要IT资产管理
为什么企业需要IT资产管理 为什么企业需要IT资产管理?其实这个问题,如同企业为什么要管理一样重要. 企业需要管理.因为有了管理,人.物可尽其用,在不同的位置.角色上发挥作用,然后按照一定的运维规则, ...
- JavaScript的使用你知道几种?(上)
往期回顾 在上一期的<JavaScript的组成 | DOM/BOM>☜里,我们有对文档对象模型-DOM.浏览器对象模型-BOM 这两大部分进行了解学习,如果有还不是很明白的小伙伴们,可以 ...
- 编译QFileSystemModel
QT在windows系统下可以直接安装,但有些时候,可以只编译一个类,这里需要有一些需要注意的.下面是github路径:https://github.com/1171597779/compile_of ...
- ios MQTT协议的实际应用
1,创建单视图项目,pod search mqtt找到一个库,然后在项目目录下pod init 出Podfile 2,pod install 安装mqtt库 3,主要代码: #import " ...
- Java堆、栈和常量池以及相关String详解
一:在JAVA中,有六个不同的地方可以存储数据: 1. 寄存器(register). 这是最快的存储区,因为它位于不同于其他存储区的地方——处理器内部.但是寄存器的数量极其有限,所以寄存器由编译器根据 ...
- 第k大元素
在数组中找到第k大的元素 样例 给出数组[9,3,2,4,8],第三大的元素是4 给出数组 [1,2,3,4,5],第一大的元素是5,第二大的元素是4,第三大的元素是3,以此类推 注意 你可以交换数组 ...
- 关于$\mathcal{D}(0,1)$上的一个有趣结论
[转载请注明出处]http://www.cnblogs.com/mashiqi 2017/02/20 在$\mathcal{D}(0,1)$上取定$\varphi_0 \in \mathcal{D}( ...
- [笔记]_ELVE_正则表达式
本文章转载至简书技匠,简书签约作者,技匠,以上内容欢迎大家分享到朋友圈/微博等. 正则表达式,一个十分古老而又强大的文本处理工具,仅仅用一段非常简短的表达式语句,便能够快速实现一个非常复杂的业务逻辑. ...