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的更多相关文章

  1. 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 ...

  2. PAT 甲级 1027 Colors in Mars (20 分)(简单,进制转换)

    1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way ...

  3. PAT 甲级 1027 Colors in Mars

    https://pintia.cn/problem-sets/994805342720868352/problems/994805470349344768 People in Mars represe ...

  4. 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 ...

  5. PAT甲级——A1027 Colors in Mars

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...

  6. 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 ...

  7. PAT 1027 Colors in Mars

    1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way ...

  8. PAT 1027 Colors in Mars[简单][注意]

    1027 Colors in Mars (20)(20 分) People in Mars represent the colors in their computers in a similar w ...

  9. 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 ...

随机推荐

  1. CodeForces - 748D Santa Claus and a Palindrome (贪心+构造)

    题意:给定k个长度为n的字符串,每个字符串有一个魅力值ai,在k个字符串中选取字符串组成回文串,使得组成的回文串魅力值最大. 分析: 1.若某字符串不是回文串a,但有与之对称的串b,将串a和串b所有的 ...

  2. h5-web字体和字体图标

    想要使用可以在: https://www.iconfont.cn/webfont?spm=a313x.7781069.1998910419.d81ec59f2#!/webfont/index :是we ...

  3. [前端] VUE基础 (9) (element-ui、axios、Vuex)

    一.element-ui的使用 官方网页:https://element.eleme.cn/#/zh-CN 1.安装element-ui (venv) D:\pycharm_workspace\vue ...

  4. 理解String的intern()方法

    API文档中的介绍: intern public String intern() Returns a canonical representation for the string object. A ...

  5. 最短路问题--Floyd 畅通工程续

    畅通工程续 某省自从实行了很多年的畅通工程计划后,终于修建了很多路.不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多.这让行人很 ...

  6. C++queue的使用

    C++队列是一种容器适配器,提供了一种先进先出的数据结构. 队列(queue)模板类定义在<queue>头文件中 基本操作: 定义一个queue变量:queue<Type> q ...

  7. css实现高度自适应

    要求.上部固定高度50px,下部分自适应剩下整个屏幕 html, body { height: 100%; margin: 0px; padding: 0px; } #main { backgroun ...

  8. Python 安装modules问题及import问题

    >>>modules问题 在学习Python的数据可视化时,安装了matplotlib,在安装完成后还特意在终端测试了一下,结果显示能正常import 但是在sublime Text ...

  9. 利用hutool配置发送邮件的问题 及 阿里企业邮箱526 Authentication failure 错误问题

    hutool 中发送邮件的配置的比较简单.可以参考hutool 官方的教程. 个人尝试了qq邮箱发送邮件 和 阿里企业邮箱发送邮件. 主要是配置不一样: 一.qq邮箱 qq邮箱 我的邮箱配置是: # ...

  10. Spring注解配置和xml配置优缺点比较

    Spring注解配置和xml配置优缺点比较 编辑 ​ 在昨天发布的文章<spring boot基于注解方式配置datasource>一文中凯哥简单的对xml配置和注解配置进行了比较.然后朋 ...