A1027 Colors in Mars (20)(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

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

  1. 15 43 71

Sample Output

  1. #123456

思考

给的数字范围是有限的168<\(13^2\)

AC代码

  1. #include <stdio.h>
  2. char radix[13] = {
  3. '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C'
  4. };
  5. int main() {
  6. int r, g, b;
  7. scanf("%d%d%d", &r, &g, &b);
  8. printf("#");
  9. printf("%c%c", radix[r / 13], radix[r % 13]);
  10. printf("%c%c", radix[g / 13], radix[g % 13]);
  11. printf("%c%c", radix[b / 13], radix[b % 13]);
  12. return 0;
  13. }

A1027 Colors in Mars (20)(20 分)的更多相关文章

  1. 1027 Colors in Mars (20 分)

    1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way a ...

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

    1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way a ...

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

  4. PAT A1027 Colors in Mars (20)

    AC代码 #include <cstdio> const int max_n = 1000; int ans[max_n]; char result[max_n]; char radix[ ...

  5. A1027. Colors in Mars

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...

  6. PAT甲级——A1027 Colors in Mars

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...

  7. PAT 1027 Colors in Mars

    1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way ...

  8. PAT 甲级 1027 Colors in Mars (20 分)(简单,进制转换)

    1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way ...

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

随机推荐

  1. wamp 下运行Drupal慢的解决方法

    1.Editing your php.ini and make realpath_cache_size=2M, 2.uncomment skip innodb in your my.cnf(my.in ...

  2. phpcms Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE错误

    我在phpcms的模板中自定义了一个变量,变量的值是通过pc标签赋予的. <?php $url="{$v[url]}"; ?> 结果报如上错误. 实际上应把PHP语句改 ...

  3. C# 调用NPOI 修改Excel 完成实时更新公式结果

    C# 调用NPOI,修改EXCEL中的数据后并保存后,不会对公式进行更新操作.打开Excel表需要更新一下公式才生效 强制更新公式:C# 调用sheet.ForceFormulaRecalculati ...

  4. mui的ajax例子2

    mui.post()方法 前端页面: <!DOCTYPE html><html><head> <meta charset="utf-8"& ...

  5. uvm_regex——DPI在UVM中的实现(三)

    UVM的正则表达是在uvm_regex.cc 和uvm_regex.svh 中实现的,uvm_regex.svh实现UVM的正则表达式的源代码如下: `ifndef UVM_REGEX_NO_DPI ...

  6. thinkphp分页+条件查询

    最近项目上面有一个带条件查询的分页列表,一开始form用的post,点击第二页就没有跳转成功,原因是分页是get请求,post数据链接到其他页面就会被清除. 解决办法: 1.form表单method= ...

  7. Windows Azure 入门 -- VS 2015部署 ASP.NET网站(项目) 与 数据库

    Windows Azure 入门 -- 部署 ASP.NET网站(项目) 与数据库 https://www.dotblogs.com.tw/mis2000lab/2015/12/24/windowsa ...

  8. 知乎日报客户端应用ios源码

    swift开发的知乎日报客户端详细源码,里面分UI和网络两个模块. 1.涉及到了大部分的UI控件的使用(甚至包括UIRefreshView,UITableConrol等等)2.Connection完成 ...

  9. json字符串转换成对象需要注意的问题

    json转换成对象的时候应该尽量避免出现特殊的符号,如“\”这样的字符在转义成数组的时候会被去除掉,最好的例子就是后台返回的内容为存储路径的JSON,这时候最好是把一个斜杠变为两个斜杠,如: [{&q ...

  10. 面试中常见的 MySQL 考察难点和热点

    基本架构 MySQL是典型的三层架构模式,在平常使用中对MySQL问题排查和优化,也应该针对具体问题,从对应的层解决问题 服务层:经典的C/S架构,主要是处理连接和安全验证. 核心层:处理MySQL核 ...