1027. Colors in Mars (20)

时间限制
400 ms

内存限制
65536 kB

代码长度限制
16000 B

判题程序
Standard

作者
CHEN, Yue

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

Each input file contains one test case which occupies a line containing the three decimal color values.

Output

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 the left.

Sample Input

15 43 71

Sample Output

#123456
简单题:
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>using namespace std;
int a,b,c;
char aa[14]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D'};
void dfs(int x,int cnt)
{if(x<13){if(cnt==0)printf("0");printf("%c",aa[x]);return;}dfs(x/13,cnt+1);printf("%c",aa[x%13]);
}
int main()
{scanf("%d%d%d",&a,&b,&c);printf("#");dfs(a,0);dfs(b,0);dfs(c,0);printf("\n");return 0;
}

转载于:https://www.cnblogs.com/dacc123/p/8228602.html

PAT 甲级 1027 Colors in Mars相关推荐

  1. PAT甲级1027 Colors in Mars :[C++题解]进制位

    文章目录 题目分析 题目链接 题目分析 就是十进制数转化成13进制,然后数字转化成字符. get函数用来将数字转化成字符. 如果 一位数 就是return x +'0'如果 大于9 就是 return ...

  2. PAT甲级 1027 Colors in Mars (20分)

    1027 Colors in Mars (20分) 题目链接:PAT A 1027 题目大意:给出三个十进制数,都是在[0-168]范围内,要求将他们转化为13进制后按顺序输出. 思路分析:非常简单的 ...

  3. 浙大PAT甲级1027. Colors in Mars (20)

    1027. Colors in Mars (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue People ...

  4. pat 1027. Colors in Mars (20)

    1027. Colors in Mars (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue People ...

  5. PTA 1027 Colors in Mars(读懂题目意思很重要!!)

    题目描述如下: 1027 Colors in Mars (20 point(s)) People in Mars represent the colors in their computers in ...

  6. 1027 Colors in Mars (20 分)_20行代码AC

    立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 People in Mars represent the colors in their computers in a simil ...

  7. 【PAT甲级 十进制转十三进制】1027 Colors in Mars (20 分) Java版 5/5通过

    题目 是个水题,一次通过. 这道题的大意就是:给你输入3个十进制的数,让你转换成3个十三进制数.在转换的时候,注意不足两位的要用0补全两位. 小坑 提交之前,想起来自查一下我的convert(int ...

  8. ZJU PAT 1027 Colors in Mars

    http://pat.zju.edu.cn/contests/pat-practise/1027 继续无聊. 数制转换一定不要忘了0. 1 #include <stdio.h> 2 #in ...

  9. 1027 Colors in Mars

    笔记:本题属于进制转换,但是考察的重点不在除基取余上,因为转化得到的数只有两位,很容易得到每位上面应该是什么,但是和其他题不同的地方在于,每位可填的不见得是0~9,还包括ABC,这就需要用字符数组而不 ...

最新文章

  1. VC++ VS2010 error LNK1123 转换到 COFF 期间失败 怎么办
  2. 中科大刘和刚老师的计算机图形学资料 for students
  3. 计算机数据与安全课件,计算机数据及软件的安全.ppt
  4. 【Java】基本语法训练题
  5. 每日一题(易错)丨Oracle SQL优化与调优技术
  6. 【Flink】Flink启动报错 BindException: Could not start rest endpoint on any port in port range 7089
  7. 你所熟知的CI/CD工具都是有哪些?
  8. DevOps 火爆,要学这么多技术!
  9. MIT机器人轻松搞定桌游叠叠乐:你能玩过它算我输 | 《科学》子刊
  10. 英特尔® 硬件加速执行管理器安装指南 — Mac OS X*
  11. 网络设备巨头优倍快的客户数据遭泄露
  12. 第一章:1.3:了解编译系统如何工作的好处
  13. error: Unable to find vcvarsall.bat
  14. colab 数据集_Google Colab上的YOLOv4:轻松训练您的自定义数据集(交通标志)
  15. ICM40607 六轴传感器简介和配置
  16. (MATLAB/C)高斯拟合法求光斑中心
  17. MYS-6ULX-IOT 开发板测评——使用MfgTool更新系统
  18. JVM 精华知识点汇总
  19. linux远程管理工具:putty
  20. SQL:要求查询出用户信息,根据用户发表的信息个数对用户进行排序

热门文章

  1. JVM_06 垃圾回收相关算法 [ 一 ]
  2. mkimage工具讲解
  3. linux命令修改管理员时间,Linux管理员必须知道的sudo命令
  4. Android Gradle Plugin 源码阅读与编译
  5. GAN——UNIT简单梳理
  6. mysql my.cnf参数配置_MySQLmy.cnf参数配置优化详解
  7. python3 修饰器_【python3】修饰器简单理解
  8. python图形编程复选按钮和单选按钮详细说明_Python_tkinter_单选框(Radiobutton)与复选框(Checkbutton)...
  9. 计算机应用与网络讲义,计算机基础讲义
  10. android必须服务,说说在Android如何使用服务(Service)的方法