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>
using namespace std;
char num[] = {'','','','','','','','','','','A','B','C'};
void deal(int oct)
{
cout<<num[oct/]<<num[oct%];
}
int main()
{
int R,G,B;
cin>>R>>G>>B;
cout<<'#';
deal(R);
deal(G);
deal(B);
return ;
}
PAT 甲级 1027 Colors in Mars (20 分)的更多相关文章
- 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 分) 凌宸1642
PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642 题目描述: People in Mars represent the c ...
- PAT甲级——1027 Colors in Mars
1027 Colors in Mars People in Mars represent the colors in their computers in a similar way as the E ...
- 【PAT甲级】1027 Colors in Mars (20 分)
题意: 输入三个范围为0~168的整数,将它们从十三进制转化为十进制然后前缀#输出. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include& ...
- 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
https://pintia.cn/problem-sets/994805342720868352/problems/994805470349344768 People in Mars represe ...
- 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甲级:1152 Google Recruitment (20分)
PAT甲级:1152 Google Recruitment (20分) 题干 In July 2004, Google posted on a giant billboard along Highwa ...
随机推荐
- linux搭建node环境
这篇完全够了! 地址:https://www.cnblogs.com/lovefc/p/8847343.html 附上一张图:
- UPX脱壳全程分析(转)
[文章标题]: UPX脱壳全程分析 [保护方式]: 本地验证 [使用工具]: OllyDBG [作者声明]: 只是感兴趣,没有其他目的.失误之处敬请诸位大侠赐教! ------------------ ...
- Python日期的加减等操作
1. 日期输出格式化 所有日期.时间的api都在datetime模块内. 1. datetime => string now = datetime.datetime.now() now.strf ...
- labeled statement:标签语句
foo: for (var i=0; i< 5; i++) { for (var j=0; j<5; j++) { if ( i == j ) { // 跳到 foo 的下一个循环 // ...
- nopcommerce 4.1 学习2 -插件之挂件
先了解下nop4.1的一些插件有哪些类型: 1.支付插件 Nop.Plugin.Payments.PayPalStandard Nop.Plugin.Payments.CheckMoneyOrd ...
- jQuery开发API参考
http://jquery.cuishifeng.cn/show.html (原地址)
- 数组的高级API-sort
按升降序排列数组项.本身存在的问题:只能通过第一位排列.解决方法:通过回调函数进行规制设置. a - b 升序. b - a 降续. 其内部运用了冒泡排序 <!DOCTYPE html> ...
- 学习Java的第一天
登录http://www.oracle.com,下载JDK(J2SE)JDK 1.0,1.1,1.2,1.3,1.4 1.5 (JDK5.0) 支持注解.支持泛型 1.6(JDK6.0) Servel ...
- 截取URL链接中字段的方法
第一个页面像第二个页面传参方法 location.href = "poster.html?" + "name=" + name + "&tim ...
- 2019-04-12-day031-进程基础
操作系统的发展历程 主要的人机矛盾是什么 : CPU的使用率 输入\输出数据和CPU计算没有关系 操作系统是怎么进化的 传统的纸带输入 磁带的存储降低了输入输出数据占用的时间,提高了CPU的利用率 多 ...