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 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 <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#define LL long long
using namespace std;
const int MAX = ; void calc13(int n)
{
stack <char> st;
while (n)
{
int temp = n % ;
if (temp >= ) st.push('A' + temp - );
else st.push('' + temp);
n /= ;
}
int len = - st.size();
while (len --)
cout <<'';
while (st.size())
{
cout <<st.top();
st.pop();
}
} int main()
{
int a, b, c;
// freopen("Date1.txt", "r", stdin);
scanf("%d%d%d", &a, &b, &c);
cout <<'#';
calc13(a) ,calc13(b) ,calc13(c) ,
cout <<endl;
return ;
}
最新文章
- Ueditor上传图片后自定义样式类名
- js动态时间
- 好老板VS坏老板
- Matlab与科学计算的基本运算
- Toolkit Pro学习--Toolbar的创建
- PHP设计模式之工厂模式(权限分配)
- 安装node配置环境变量,解决某组件(如cordova,webpack等)“不是内部命令”问题
- 蓝桥杯-核桃的数量-java
- MongoDB--MapReduce分布统计s
- 用css3的cursor:zoom-in/zoom-out实现微博看图片放大镜效果
- Git多帐号配置,管理多个SSH
- 你不知道的JS之 this 和对象原型(一)this 是什么
- Factorized Hidden Variability Learning For Adaptation Of Short Duration Language Identification Models
- map数据结构
- docker安装(2018-03-14版本)
- maven -- 问题解决(一)解决eclipse中maven项目配置过程和maven install时出现的问题
- 解决 swap file “*.swp”already exists!问题
- 【Luogu3676】小清新数据结构题(动态点分治)
- 项目笔记:list页面展示与交互设计
- Java权威编码规范