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 ...
随机推荐
- 51nod 1392:装盒子 匈牙利+贪心
1392 装盒子 基准时间限制:1 秒 空间限制:131072 KB 分值: 160 难度:6级算法题 收藏 关注 有n个长方形盒子,第i个长度为Li,宽度为Wi,我们需要把他们套放.注意一个盒子 ...
- 第21章—websocket
spring boot 系列学习记录:http://www.cnblogs.com/jinxiaohang/p/8111057.html 码云源码地址:https://gitee.com/jinxia ...
- Uber推出全新交通估算体系能颠覆传统模式吗?
当下,大众的交通出行正在被全面颠覆.除了传统的出行方式外,共享打车.共享单车.共享滑板车.分时租赁的共享汽车等,正在形成一个全新交通出行矩阵.鉴于交通出行市场的巨大潜力,众多巨头及独角兽企业在绞尽脑汁 ...
- 云服务器Linux版本下---安装git
xshell进入云服务器: 按照git官网:https://git-scm.com/download/linux 的教程输入: apt-get install git 本地没有包????? 原来是 ...
- 2020牛客寒假算法基础集训营3 B 牛牛的DRB迷宫II
题目描述 牛牛有一个n*m的迷宫,对于迷宫中的每个格子都为'R','D','B'三种类型之一,'R'表示处于当前的格子时只能往右边走'D'表示处于当前的格子时只能往下边走,而'B'表示向右向下均可以走 ...
- C#用户控件的使用
1.添加一个用户控件 2.编辑用户控件,相当于自己定义了一个控件,和其他控件一样在窗体中使用,是一个类. 右击项目,生成一下,就可以看到窗体的工具箱上面多了一组工具,可以看到我们定义的控件login ...
- [极客大挑战 2019]Http
0x00知识点 了解HTTP协议,使用bp伪造. 0x01 解题 首先查看源代码,找到Secret.php 访问 使用bp查看 提示我们需要来自该网址,直接改header头信息即可,我们可以通过使用r ...
- Python—在Django中使用Celery
一.Django中的请求 Django Web中从一个http请求发起,到获得响应返回html页面的流程大致如下: http请求发起 经过中间件 http handling(request解析) ur ...
- SeetaFaceEngine系列2:Face Alignment编译和使用
前面一篇写了编译人脸检测部分,现在就介绍下人脸配准部分,SeetaFace的Face Alignment通过人脸的五个关键点来配准人脸,也就是双眼.鼻尖.两个嘴角. 这部分的编译也和上一篇一样,步骤如 ...
- eclipse配置tomcat详细步骤
1.下载tomcat9并解压到D盘根目录下 2.Windows——>Preferences——>Server——>Runtime Environments——>Add 3.选择 ...