当前位置:网站首页>1027 Colors in Mars
1027 Colors in Mars
2022-06-27 17:56:00 【Brosto_Cloud】
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>
#include <string>
using namespace std;
void convert(int i) {
if (i >= 10) {
cout << (char)('A' + i - 10);
} else {
cout << i;
}
}
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << '#';
int x, y;
x = a / 13;
y = a % 13;
convert(x);
convert(y);
x = b / 13;
y = b % 13;
convert(x);
convert(y);
x = c / 13;
y = c % 13;
convert(x);
convert(y);
return 0;
}
边栏推荐
- Buzzer experiment based on stm32f103zet6 library function
- Pyhton爬取百度文库文字写入word文档
- 今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献
- 云笔记到底哪家强 -- 教你搭建自己的网盘服务器
- 让单测变得如此简单 -- spock 框架初体验
- Jinyuan's high-end IPO was terminated: it was planned to raise 750million Rushan assets and Liyang industrial investment were shareholders
- 金源高端IPO被终止:曾拟募资7.5亿 儒杉资产与溧阳产投是股东
- 形参的默认值-及return的注意事项-及this的使用-和箭头函数的知识
- 信息学奥赛一本通 1333:【例2-2】Blah数集 | OpenJudge NOI 3.4 2729:Blah数集
- Market status and development prospect forecast of the global shuttleless air jet loom industry in 2022
猜你喜欢

crontab的学习随笔

Running lantern experiment based on stm32f103zet6 library function

Bit. Store: long bear market, stable stacking products may become the main theme
![[elt.zip] openharmony paper Club - memory compression for data intensive applications](/img/b3/ab915f0338174cba1a003edc262a5d.png)
[elt.zip] openharmony paper Club - memory compression for data intensive applications

如何利用 RPA 实现自动化获客?

Minmei new energy rushes to Shenzhen Stock Exchange: the annual accounts receivable exceeds 600million and the proposed fund-raising is 450million

基于STM32F103ZET6库函数按键输入实验

Error reported by Huada MCU Keil_ Weak's solution

在线文本按行批量反转工具

Bit. Store: long bear market, stable stacking products may become the main theme
随机推荐
International School of Digital Economics, South China Institute of technology 𞓜 unified Bert for few shot natural language understanding
maxwell 报错(连接为mysql 8.x)解决方法
Function key input experiment based on stm32f103zet6 Library
GIS remote sensing R language learning see here
The Fifth Discipline: the art and practice of learning organization
Blink SQL内置函数大全
Running lantern experiment based on stm32f103zet6 library function
实施MES管理系统前,要对哪些问题进行评估
A simple calculation method of vanishing point
Informatics Olympiad 1333: [example 2-2] blah data set | openjudge noi 3.4 2729:blah data set
Market status and development prospect forecast of global active quality control air sampler industry in 2022
Market status and development prospect forecast of global functional polyethylene glycol (PEG) industry in 2022
[elt.zip] openharmony paper Club - memory compression for data intensive applications
【云驻共创】高校数字化差旅建设“解决之道”
可靠的分布式锁 RedLock 与 redisson 的实现
信息学奥赛一本通 1335:【例2-4】连通块
Jinyuan's high-end IPO was terminated: it was planned to raise 750million Rushan assets and Liyang industrial investment were shareholders
Introduction to deep learning and neural networks
DFS and BFS simple principle
Cucumber自动化测试框架使用