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.h>
#include <cstring>
#include <algorithm>
#include <cstdio>
using namespace std;
char _deal(int x)
{
if(x>=&&x<) return x+'';
else if(x>=) return x+'A'-;
}
int main()
{
int a,b,c;
while(cin>>a>>b>>c){
char s[];
s[]='#';
int tmp=a/;
s[]=_deal(tmp);
tmp=a%;
s[]=_deal(tmp);
tmp=b/;
s[]=_deal(tmp);
tmp=b%;
s[]=_deal(tmp);
tmp=c/;
s[]=_deal(tmp);
tmp=c%;
s[]=_deal(tmp);
printf("%s\n",s);
}
return ;
}

PAT (Advanced Level) Practice 1027 Colors in Mars (20 分)的更多相关文章

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

  2. PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642 题目描述: A number that will ...

  3. PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...

  4. PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642 题目描述: Given a non-negative integer N ...

  5. PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642 题目描述: Calculate a+b and output the sum i ...

  6. PAT (Advanced Level) Practice 1054 The Dominant Color (20 分)

    Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of i ...

  7. PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) (进制转换,回文数)

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

  8. PAT (Advanced Level) Practice 1005 Spell It Right (20 分) (switch)

    Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output e ...

  9. PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) (找最值)

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

随机推荐

  1. ASP.NET Core使用环境变量

    前言 通常在应用程序开发到正式上线,在这个过程中我们会分为多个阶段,通常会有 开发.测试.以及正式环境等.每个环境的参数配置我们会使用不同的参数,因此呢,在ASP.NET Core中就提供了相关的环境 ...

  2. 服务器安全之iptables

    服务器安全之iptables iptables防火墙简介 Netfilter/Iptables(以下简称Iptables)是unix/linux自带的一款优秀且开放源代码的安全自由的基于包过滤的防火墙 ...

  3. light oj 1095 - Arrange the Numbers排列组合(错排列)

    1095 - Arrange the Numbers Consider this sequence {1, 2, 3 ... N}, as an initial sequence of first N ...

  4. 部署LAMP环境搭建一个网站论坛平台

    修改主机名 Hostname openstack-001 Hostname Login 修改本地域名解析 Vi /etc/hosts 最后一行添加 192.168.1.56 openstack-001 ...

  5. C++泛化动态数组

    泛化动态数组 动态数组的核心思想是在存储数据时动态的管理数组元素占用的内存,通过调用动态数组的类方法来对数组中的数据进行增删改查操作.最初我们为数组申请10个元素的空间,放我们不断向数组中添加数据时, ...

  6. 【HDU - 1260 】Tickets (简单dp)

    Tickets 搬中文 Descriptions: 现在有n个人要买电影票,如果知道每个人单独买票花费的时间,还有和前一个人一起买花费的时间,问最少花多长时间可以全部买完票. Input 给出 N(1 ...

  7. C# 制作关键字醒目显示控件

    实现方式:WinForm自定义控件,继承系统Label控件实现. 第1步:创建“组件”,取名为:MarkLabel     第2步:修改添加如下代码: /* 添加命名空间引用: * using Sys ...

  8. 解决H5页面点击一瞬间出现灰色背景的问题

    H5页面有时会出现点击一瞬间出现灰色背景的问题(ios会,安卓不会),解决方法: 加上样式: -webkit-tap-highlight-color: transparent; 如果以上方法不行,则是 ...

  9. [MySQL]ANALYZE TABLE 更新索引基数

    MySQL使用存储的键分布基数来确定表连接顺序在决定对查询中的特定表使用哪些索引时,也会使用使用键分布基数 ANALYZE TABLE 表名 可以更新表的索引基数,使其更接近非重复的记录数,记录数可以 ...

  10. Git命令行操作方法

    1.GitHub上创建一个Repositories(仓库),并复制仓库地址