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 ...
随机推荐
- python 实现树结构
简述: 研究 MCTS 过程中, 需要用到树结构. baidu google 了一番, 找不到自己能满足自己的库或代码参考,只好再造个轮子出来 我造的树用来下五子棋 和 围棋用的, 有其它不 ...
- python -- while循环,格式化输出,运算符,初识编码
一.while循环 1.语法 while 条件: 循环体(结果) 如果条件为真,则直接执行结果),然后再次判断条件,知道条件为假,停止循环. while True: print('你是谁呢') 退 ...
- 正确学习Linux系统的5个建议
摘要: 最近几年Linux系统应用越来越广泛,以至于很多人开始热衷学习Linux.但是我们都是从小都是学习windows系统长大的,从windows 98到现在的windows 10,而根据学习win ...
- VSTO:使用C#开发Excel、Word【16】
使用工作表对象Worksheet对象表示Excel工作簿中的工作表.Worksheet有一个Name属性,返回工作表的名称(例如“Sheet1”). 工作表管理Worksheet对象具有一个Index ...
- HTTP的缓存策略
etag 与 if-match https://www.cnblogs.com/huangzhilong/p/4999207.html https://juejin.im/post/5c136bd16 ...
- Binary Tree Maximum Node
Find the maximum node in a binary tree, return the node. Example Given a binary tree: 1 / \ -5 2 / \ ...
- C程序第三次作业
6-1 输出月份英文名 PTA提交列表: 1.设计思路 (1)主要描述题目算法 第一步:将十二个月的名称分别赋值给一维数组指针,定义用于返回的数据类型. 第二步:遍历数组,满足若n在1-12范围则将m ...
- vs2017 编译vue 错误 TS2307 Build:找不到模块“webpack”。
升级了vs2017之后,编译之前正常的工程,发现出现了对vue的编译错误, 提示一些列找不到模块的错误 错误 TS2307 Build:找不到模块“webpack”. ...... 错误 TS2345 ...
- MacBook使用笔记2 - 安装windows虚拟机攻略
转载请标注原链接:http://www.cnblogs.com/xczyd/p/5498878.html 5月初从阿里滚粗,然后失去了公司发的Mac Air.说实话Mac机器确实比windows好用一 ...
- CCF-权限查询-201612-3
这道题,开始只有10分.....原因是将false 写成了 flase 我要吐血而亡....关键是还debug了半天,以为是逻辑错了 不过亮点是代码很简洁,网上140+的代码看着真复杂 核心: 做题之 ...