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 ;
}
pat 1027 Colors in Mars(20 分)的更多相关文章
- PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642
PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642 题目描述: People in Mars represent the c ...
- PAT 甲级 1027 Colors in Mars (20 分)(简单,进制转换)
1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way ...
- PAT Advanced 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- PAT (Advanced Level) Practice 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- 【PAT甲级】1027 Colors in Mars (20 分)
题意: 输入三个范围为0~168的整数,将它们从十三进制转化为十进制然后前缀#输出. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include& ...
- 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- PAT 1027 Colors in Mars[简单][注意]
1027 Colors in Mars (20)(20 分) People in Mars represent the colors in their computers in a similar w ...
- PAT 1027 Colors in Mars
1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way ...
- 1027. Colors in Mars (20) PAT
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1027 简单题,考察十进制数和n进制数的转换和输出格式的控制. People in Mars rep ...
随机推荐
- webshell检测方法归纳
背景 webshell就是以asp.php.jsp或者cgi等网页文件形式存在的一种命令执行环境,也可以将其称做为一种网页后门.黑客在入侵了一个网站后,通常会将asp或php后门文件与网站服务器WEB ...
- CSS中重要的BFC
CSS中有个重要的概念BFC,搞懂BFC可以让我们理解CSS中某些原本看似诡异的地方. 简介 在解释BFC之前,先说一下文档流.我们常说的文档流其实分为定位流.浮动流.普通流三种.而普通流其实就是指B ...
- [NOIp2009] luogu P1073 最优贸易
md 我发现跟你们聊天贼没意思. 题目描述 我觉得描述挺好,不改了吧. Solution 容易发现这是道 dfs + DP 的乱搞题. 设 f[x]f[x]f[x] 表示到 xxx 这个点的最优答案. ...
- Bzoj 4806 炮 (dp)
题目描述 众所周知,双炮叠叠将是中国象棋中很厉害的一招必杀技.炮吃子时必须隔一个棋子跳吃,即俗称"炮打隔子". 炮跟炮显然不能在一起打起来,于是rly一天借来了许多许多的炮在棋盘 ...
- Ubuntu使用中遇到的的一些问题
制作ubuntu启动盘后,U盘只读. ubuntu自带的"启动盘创建器(usb-creator-gtk)"制作启动盘后,U盘只读. 打开ubuntu自带的"磁盘(hard ...
- POST PUT 小解
POST 主要是用来提交数据让服务器进行处理的,PUT主要是请求数据的. POST 提交的数据放在HTTP正文里面,而PUTT提交的数据放在url里面.
- Mac系统 安装Photoshop CC 2018破解版
应用场景 本人从事前端行业,但是工作中有时也需要会点PS技能,之前一直使用window系统,突然换了Mac其他软件基本都差不多安装完了,就剩下比较难搞的PS.刚开始按照网上乱七八槽的教程下载过好多次都 ...
- ajax 轮询(适合web端二维码请求)
(前几天 一直弄二维码轮询登录 想了半天 总算弄出来了 分享给大家 ^-^) 轮询: 所谓轮询 肯定需要 setInterval 但是怎么加ajax请求 需要有点小问题而且轮询成功后需要停 ...
- cmd 获取当前登录的用户和远程连接的用户
打开cmd 执行 quser 可以看到我有两个 会话 带> 是我当前的会话 rdp 是远程连接的会话 console 是本机操作 可以知道谁在连接你 状态是 唱片 就是未连接的意思 ...
- textView 实现完成收键盘操作
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSStr ...