PAT甲级——1027 Colors in Mars
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<cstdio>
#include<iostream>
using namespace std;
int main()
{
const char a[13]={'0','1','2','3','4','5','6','7','8','9','A','B','C'};
int r,g,b;
scanf("%d%d%d%",&r,&g,&b);
printf("#");
printf("%c%c",a[r/13],a[r%13]);
printf("%c%c",a[g/13],a[g%13]);
printf("%c%c",a[b/13],a[b%13]);
return 0;
}
PAT甲级——1027 Colors in Mars的更多相关文章
- PAT 甲级 1027 Colors in Mars (20 分)
1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way a ...
- 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 甲级 1027 Colors in Mars
https://pintia.cn/problem-sets/994805342720868352/problems/994805470349344768 People in Mars represe ...
- 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甲级——A1027 Colors in Mars
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 (20 分) People in Mars represent the colors in their computers in a similar way ...
- PAT 1027 Colors in Mars[简单][注意]
1027 Colors in Mars (20)(20 分) People in Mars represent the colors in their computers in a similar w ...
- 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 ...
随机推荐
- PSI-BLAST|PHI-BLAST|UniProt|IGV|Galaxy|clustalx
生物信息学软件: NCBI:BLAST,设定k-mer 默认是全局比对,Blastn是局部比对. PSI-BLAST最灵敏的BLAST,选中部分矩阵后在数据库中查找相应蛋白. PHI-BLAST找氨基 ...
- Gym - 101142C CodeCoder vs TopForces(搜索)
题意:给定n个人在两个网站上的得分,一个人若能在任意一个网站里战胜另一个人,则认为这个人能战胜那个人.问每个人都能战胜多少人. 分析: 1.战胜具有传递性. 例如: 4 5 2 7 3 3 因为第三个 ...
- php封装一个接口类
<?phpClass Response{//返回数据 public static function show($code,$message='',$data='',$type = 'json', ...
- MLP神经网络 隐含层节点数的设置】如何设置神经网络隐藏层 的神经元个数
神经网络 隐含层节点数的设置]如何设置神经网络隐藏层 的神经元个数 置顶 2017年10月24日 14:25:07 开心果汁 阅读数:12968 版权声明:本文为博主原创文章,未经博主允许不得转 ...
- 多种类型SQL注入
前言 发现MYSQL手注注入方式用得多了,几乎都快忘记其它数据库注入的方式了,这里不讲绕过姿势和写shell,毕竟网上很多前辈都给了方法,我只讲一些基本的注入方式(只是记录一下各自的特性,记下来方便以 ...
- js样式添加
document.getElementsByName("spans")[index].style.color = "blue";
- error_reporting() 设置 PHP 的报错级别并返回当前级别
error_reporting() 设置 PHP 的报错级别并返回当前级别. 语法 error_reporting(report_level) 如果参数 level 未指定,当前报错级别将被返回.下面 ...
- Excel文件比较工具的使用
本工具用于比较两个文件夹中对应Excel工作簿中单元格数据是否不同. 如果有内容不同的单元格,就在结果报告中表示出来. 点击如下链接,下载. Excel文件比较工具.rar 解压缩后,看到1个exe文 ...
- StringBuiler和StringBuffer的区别
String.StringBuiler.和StringBuffer都是可以对字符串进行处理的类,他们3个的主要区别在于,运行的速度,还有运行时的线程安全问题. 运行速度方面,它们的快慢顺序依次为:St ...
- Golang解析json的几种方法
Golang解析json的几种方法 概要 使用Golang调用其它平台API接口时总会被多层的json串给恶心到,我记录一下自己解析json的几种方法. 一.自带的json包 func JsonUnm ...