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 ;
}

最新文章

  1. JavaScript 与函数式编程
  2. mysql优化(三)–explain分析sql语句执行效率
  3. ASP.NET 状态的传递和保存
  4. [转]C 语言指针的使用
  5. 异常java.lang.IllegalStateException的解决
  6. Beginning MyBatis 3 Part 2 : How to Handle One-to-Many and One-to-One Selects
  7. bzoj1070————2016——3——14
  8. 1131: [POI2008]Sta
  9. 第一部分----HTML的基本结构与基本标签
  10. 【转】CPU与内存的那些事
  11. Spring常用配置
  12. vsftpd 的端口模式以及端口映射问题
  13. oracl遇到的问题
  14. JavaScript如何正确处理Unicode编码问题!
  15. MySQL中KEY、PRIMARY KEY、UNIQUE KEY、INDEX 的区别
  16. [原]Jenkins(一)---我理解的jenkins是这样的(附全套PDF下载)
  17. 使用ssm(spring+springMVC+mybatis)创建一个简单的查询实例(三)(错误整理篇)
  18. [luogu4201][bzoj1063]设计路线【树形DP】
  19. MVC字符串转json,ajax接受json返回值
  20. &lt;spark&gt; hadoop/spark 集群搭建

热门文章

  1. 业余无线电A类考试准备笔记
  2. LeetCode 684. Redundant Connection 冗余连接(C++/Java)
  3. 阿里云服务器ECS Ubuntu18.04 建立新用户
  4. ajax 解决中文乱码问题
  5. lwip netbuf
  6. LwIP的udp学习笔记
  7. nginx-tengine集合
  8. zabbix-proxy配置文件参数说明
  9. Node.js的__dirname,__filename,process.cwd(),./的一些坑
  10. JS推箱子游戏