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 ...
随机推荐
- 快速傅里叶变换(FFT)略解
前言 如果我们能用一种时间上比 \(O(n^2)\) 更优秀的方法来计算大整数(函数)的乘法,那就好了.快速傅里叶变换(FFT) 可以帮我们在 \(O(n\log n)\) 的时间内解决问题. 函数乘 ...
- [JZOJ5866]【NOIP2018模拟9.13】指引
Description
- JVM 启动调优总结
启动命令 格式: java -jar 命令行参数 jar包路径 .示例如下 java -Dfile.encoding=utf-8 -jar -XX:MetaspaceSize=128m -XX:Max ...
- textbox获取焦点选中内容
前台: <TextBox VerticalAlignment="> <TextBox.Style> <Style TargetType="TextBo ...
- 【Java】遍历List/Set/Map集合的一些常用方法
/* * 遍历List/Set/Map集合的一些常用方法 */import java.util.ArrayList;import java.util.HashMap;import java.util. ...
- Python中Linux开发的技巧
Python的Linux基础目录 操作系统 Windows和Linux的区别 常用基本命令1.操作系统 1 操作系统的作用:向上支持应用软件的运行,向下控制硬件,软件和硬件的过渡层Linux的版本 ...
- Kong02-KongA 介绍
KongA 是 Kong 的一个 GUI 工具.GitHub 地址是 https://github.com/pantsel/konga . KongA 概述 KongA 带来的一个最大的便利就是可以很 ...
- 网络安全-主动信息收集篇第二章-二层网络扫描之nmap
nmap是网络层.传输层最重要的扫描工具之一,可以结合脚本对应用层的扫描和对网络弱点发现. 网络层发现nmap使用: Usage: nmap [Scan Type(s)] [Options] {tar ...
- Nginx 的请求处理流程,你了解吗?
之前我们已经讲解了 Nginx 的基础内容,接下来我们开始介绍 Nginx 的架构基础. 为什么我们要讨论 Nginx 的架构基础? 因为 Nginx 运行在企业内网的最外层也就是边缘节点,那么他处理 ...
- day 2上午 elect 选举 背包
#include<iostream> using namespace std; int n; ; ]; long long p[maxn]; long long dp[maxn][maxn ...