当前位置:网站首页>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;
}
边栏推荐
- 网络传输是怎么工作的 -- 详解 OSI 模型
- 运算符的基础知识
- Don't worry. This is the truth about wages in all industries in China
- DCC888 :Register Allocation
- [elt.zip] openharmony paper Club - memory compression for data intensive applications
- binder hwbinder vndbinder
- 什么是SSR/SSG/ISR?如何在AWS上托管它们?
- 昱琛航空IPO被终止:曾拟募资5亿 郭峥为大股东
- 驾驭一切的垃圾收集器 -- G1
- Labelimg usage guide
猜你喜欢
Usage of rxjs mergemap
国际数字经济学院、华南理工 | Unified BERT for Few-shot Natural Language Understanding(用于小样本自然语言理解的统一BERT)
Running lantern experiment based on stm32f103zet6 library function
xctf攻防世界 MISC薪手进阶区
基于STM32F103ZET6库函数外部中断实验
金源高端IPO被终止:曾拟募资7.5亿 儒杉资产与溧阳产投是股东
今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献
过关斩将,擒“指针”(下)
openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
《第五项修炼》(The Fifth Discipline):学习型组织的艺术与实践
随机推荐
信息学奥赛一本通 1335:【例2-4】连通块
你知道 log4j2 各项配置的全部含义吗?带你了解 log4j2 的全部组件
可靠的分布式锁 RedLock 与 redisson 的实现
Cloud native database: the outlet of the database, you can also take off
Comment encapsuler un appel à une bibliothèque
全面解析零知识证明:消解扩容难题 重新定义「隐私安全」
工作流自动化 低代码是关键
Error reported by Huada MCU Keil_ Weak's solution
中金证券经理给的开户二维码安全吗?找谁可以开户啊?
Crawl national laws and Regulations Database
New Zhongda chongci scientific and Technological Innovation Board: annual revenue of 284million and proposed fund-raising of 557million
数仓的字符截取三胞胎:substrb、substr、substring
Market status and development prospect forecast of global tetramethylammonium hydroxide developer industry in 2022
国际数字经济学院、华南理工 | Unified BERT for Few-shot Natural Language Understanding(用于小样本自然语言理解的统一BERT)
别焦虑了,这才是中国各行业的工资真相
How to encapsulate and call a library
高收益银行理财产品在哪里看?
shell脚本常用命令(三)
shell脚本常用命令(四)
广发期货开户安全吗?