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>
#include<stdlib.h>
#include<vector>
#include<algorithm>
using namespace std;
char num[] = { '','','','','','','','','','','A','B','C' }; int main()
{
int color[];
string a = "";
int j = ;
for (int i = ; i < ; i++)
{
j = i*;
cin >> color[i];
int temp = color[i];
while (temp)
{
a[j++]= num[temp % ];
temp /= ;
}
}
cout << "#";
for (int j = ; j < ; j += )
cout << a[j] << a[j - ];
return ;
}

1027 Colors in Mars (20 分)的更多相关文章

  1. PAT 甲级 1027 Colors in Mars (20 分)(简单,进制转换)

    1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 【PAT甲级】1027 Colors in Mars (20 分)

    题意: 输入三个范围为0~168的整数,将它们从十三进制转化为十进制然后前缀#输出. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include& ...

  6. 1027. Colors in Mars (20) PAT

    题目:http://pat.zju.edu.cn/contests/pat-a-practise/1027 简单题,考察十进制数和n进制数的转换和输出格式的控制. People in Mars rep ...

  7. PAT1027 Colors in Mars (20分) 10进制转13进制

    题目 People in Mars represent the colors in their computers in a similar way as the Earth people. That ...

  8. 1027 Colors in Mars (20)

    #include <stdio.h> #include <map> using namespace std; int main() { int R,G,B,i; map< ...

  9. PAT (Advanced Level) 1027. Colors in Mars (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...

随机推荐

  1. bug的前世今生

    项目上发现的产品bug,若本地有问题,那就是漏测 1.提到产品bug系统 2.需要追踪,要么是漏测,要么是改出来的问题,漏测的需要补充到测试点里 项目上发现的产品bug,若本地没问题,那就是项目上的产 ...

  2. 用libvlc 播放指定缓冲区中的视频流

    有时候,我们需要播放别的模块传输过来的视频流,VLC提供了这样的机制,但一般很少这样用,下面的例子实现了这样的功能. 其中用到一个关键的模块 imem.  vlc提供多种创建媒体的方式,如要从指定缓存 ...

  3. css3 HSLA 颜色制造半透明效果

    简介 HSL色彩模式是工业界的一种颜色标准,是通过对色调(H).饱和度(S).亮度(L)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的,HSL即是代表色调,饱和度,亮度三个通道的颜色, ...

  4. (转)协议森林14 逆袭 (CIDR与NAT)

    协议森林14 逆袭 (CIDR与NAT) 作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! IPv4由于最初的设计原因,长度只有32 ...

  5. 原来rollup这么简单之 rollup.generate + rollup.write篇

    大家好,我是小雨小雨,致力于分享有趣的.实用的技术文章. 内容分为翻译和原创,如果有问题,欢迎随时评论或私信,希望和大家一起进步. 分享不易,希望能够得到大家的支持和关注. 计划 rollup系列打算 ...

  6. sklearn概述

    Simple and efficient tools for predictive data analysis Accessible to everybody, and reusable in var ...

  7. 关于LaTex的安装

    第一次写博客,有点生疏,但是想把具体安装的流程自我的汇总一下,毕竟我总是忘记,万一下一次要用的时候又要弄很久,就当经验吧. 其实是因为这个新型冠状病毒不能出门,也没开学,想找点事情做一做 这个博客不知 ...

  8. Callable的Future模式

    一.线程实现方式 1.继承Thread类 2.实现Runnable接口 3.线程池 4.Callable 二.无论使用继承Thread类还是实现Runnable接口,还是使用线程池都没有办法解决2个问 ...

  9. Journal of Proteomics Research | 利用混合蛋白质组模型对MBR算法中错误转移鉴定率的评估

    题目:Evaluating False Transfer Rates from the Match-between-Runs Algorithm with a Two-Proteome Model 期 ...

  10. Selenium系列(三) - 针对元素常见的简单操作

    如果你还想从头学起Selenium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1680176.html 其次,如果你不懂前端基础知识, ...