当前位置:网站首页>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;
}
边栏推荐
- Implementation of reliable distributed locks redlock and redisson
- Market status and development prospect forecast of global functional polyethylene glycol (PEG) industry in 2022
- 数仓的字符截取三胞胎:substrb、substr、substring
- 可靠的分布式锁 RedLock 与 redisson 的实现
- 判断一个变量是数组还是对象?
- [elt.zip] openharmony paper Club - memory compression for data intensive applications
- Market status and development prospect forecast of global tetramethylammonium hydroxide developer 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
- Code and principle of RANSAC
- Market status and development prospect forecast of global handheld ventilator industry in 2022
猜你喜欢

xctf攻防世界 MISC薪手进阶区

Blink SQL内置函数大全

金源高端IPO被终止:曾拟募资7.5亿 儒杉资产与溧阳产投是股东

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

Jinyuan's high-end IPO was terminated: it was planned to raise 750million Rushan assets and Liyang industrial investment were shareholders

清华徐勇、段文晖研究组开发出高效精确的第一性原理电子结构深度学习方法与程序

拥抱云原生:江苏移动订单中心实践

芯动联科冲刺科创板:年营收1.7亿 北方电子院与中城创投是股东

“我让这个世界更酷”2022华清远见研发产品发布会圆满成功

Running lantern experiment based on stm32f103zet6 library function
随机推荐
华大单片机KEIL添加ST-LINK解决方法
金源高端IPO被终止:曾拟募资7.5亿 儒杉资产与溧阳产投是股东
Is it safe to buy stocks and open an account on the account opening link of the securities manager? Ask the great God for help
How to encapsulate and call a library
【建议收藏】ABAP随笔-EXCEL-4-批量导入-推荐
Campus book resource sharing platform
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
拥抱云原生:江苏移动订单中心实践
DFS and BFS simple principle
一对一关系
作用域-Number和String的常用Api(方法)
循环遍历及函数基础知识
让单测变得如此简单 -- spock 框架初体验
The IPO of Yuchen Airlines was terminated: Guozheng was proposed to raise 500million yuan as the major shareholder
云笔记到底哪家强 -- 教你搭建自己的网盘服务器
Market status and development prospect forecast of the global infusion needle less connector industry in 2022
Current market situation and development prospect forecast of the global ductless heating, ventilation and air conditioning system industry in 2022
NVIDIA Clara-AGX-Developer-Kit installation
laravel框架中 定时任务的实现
Market status and development prospect forecast of phenethyl resorcinol for skin care industry in the world in 2022