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 ...
随机推荐
- Vue项目在真机测试
一:修改config 找到config文件夹下的index.js文件并修改为: module.exports = { dev: { host: '0.0.0.0' // 原为: hotst: 'loc ...
- js parseInt()与Number()区别
说到转换成数字类型,我首先想到的是parseInt()方法,后来接触多了才发现还有一个Number()方法,同样是转换成数字类型,这两种方法有什么不同的呢? 1.parseInt(): pa ...
- linux-Centos7安装python3并与python2共存
1.查看是否已经安装Python CentOS 7.2 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的是python2.7.5. 使用 python -V 命令查看一下是否安 ...
- PDF 补丁丁 0.6.0.3282 版发布(修复内存漏洞)
补丁丁的新测试版修复了旧版在导出图片.分析文件结构时的内存漏洞. 对于希望表达对本软件感情的用户,可点击“帮助”菜单的“关于本程序及作者”命令,用微信扫描里面的二维码表达您的谢意. 新的测试版正在制作 ...
- Python *Mix_w8
文件操作的函数 文件可迭代 open(文件名(路径), mode="?", encoding="字符集") f = open("../Python/是 ...
- day41-python多进程多线程-多线程共享
线程共享变量多线程和多进程不同之处在于多线程本身就是可以和父进程共享内存的,这也是为什么其中一个线程挂掉以后,为什么其他线程也会死掉的道理. import threading def worker() ...
- 【Java集合系列二】LinkedList解析
一.简介 1.LinkedList继承关系 2.LinkedList底层实现 LinkedList使用双向链表存储数据,所以没有默认的容量,也不会有扩容一说.只有两个指针,永远指向链表的两端:firs ...
- VSTO:使用C#开发Excel、Word【12】
Excel对象模型中的事件了解excel对象模型中的事件至关重要,因为这通常是代码运行的主要方式.本章将检查Excel对象模型中的所有事件,引发事件以及可能与这些事件关联的代码类型. Excel对象模 ...
- php解析Excel表格并且导入MySQL数据库
最近根据客户需求,需要增加一个导入Excel表格的功能,Excel中存放的是知识库中医知识的分类体系目录.是在thinkphp框架下编写的代码,用的是phpexcel第三方包.测试环境用的是xampp ...
- 一、fopen与fclose
需要包含的头文件为stdio.h fopen 原型:FILE *fopen(const char *path, const char *mode); 返回:打开成功则返回文件流指针,失败则返回空 参数 ...