当前位置:网站首页>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;
}
边栏推荐
- 工作流自动化 低代码是关键
- Tupu digital twin intelligent energy integrated management and control platform
- Redis 原理 - String
- Blink SQL内置函数大全
- Market status and development prospect forecast of global tetramethylammonium hydroxide developer industry in 2022
- redis集群系列三
- 数仓的字符截取三胞胎:substrb、substr、substring
- Vs code runs "yarn run dev" and reports "yarn": the file XXX cannot be loaded
- 一位平凡毕业生的大学四年
- 判断一个变量是数组还是对象?
猜你喜欢

《第五项修炼》(The Fifth Discipline):学习型组织的艺术与实践

Don't worry. This is the truth about wages in all industries in China

Vs code runs "yarn run dev" and reports "yarn": the file XXX cannot be loaded

VS code 运行yarn run dev 报yarn : 无法加载文件XXX的问题

Blink SQL内置函数大全

binder hwbinder vndbinder

全面解析零知识证明:消解扩容难题 重新定义「隐私安全」

C# 二维码生成、识别,去除白边、任意颜色

指针和结构体

拥抱云原生:江苏移动订单中心实践
随机推荐
Cucumber自动化测试框架使用
(LC)46. 全排列
Error reported by Huada MCU Keil_ Weak's solution
Buzzer experiment based on stm32f103zet6 library function
binder hwbinder vndbinder
redis集群系列三
基于STM32F103ZET6库函数跑马灯实验
labelimg使用指南
一位平凡毕业生的大学四年
crontab的学习随笔
Memoirs of actual combat: breaking the border from webshell
破解仓储难题?WMS仓储管理系统解决方案
基于STM32F103ZET6库函数外部中断实验
现在网上买股票开户身份证信息安全吗?
華大單片機KEIL報錯_WEAK的解决方案
中金证券经理给的开户二维码安全吗?找谁可以开户啊?
Market status and development prospect forecast of global active quality control air sampler industry in 2022
Core dynamic Lianke rushes to the scientific innovation board: with an annual revenue of 170million yuan, Beifang Electronics Institute and Zhongcheng venture capital are shareholders
Erreur Keil de Huada Single Chip Computer La solution de Weak
广发期货开户安全吗?