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

15 43 71

Sample Output

#123456

思考

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

AC代码

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

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. 13.padding和margin,几种参数

    这篇会很短. 那么如上图所示,margin指的是外边距,padding指的是内边距,border自有其像素宽度,element在1335乘以392的地方. margin和padding一样总共有四个, ...

  2. SpringBoot2.0之三 优雅整合Spring Data JPA

      在我们的实际开发的过程中,无论多复杂的业务逻辑到达持久层都回归到了"增删改查"的基本操作,可能会存在关联多张表的复杂sql,但是对于单表的"增删改查"也是不 ...

  3. $.ajax和$.load的区别

    http://lib.csdn.net/article/jquery/35614?knId=646

  4. Django之model基础(查询补充)

    学习完简单的单表查询外,是远远不够的,今天我们对查询表记录做一个补充,接下来来看看基于对象的跨表查询.基于双下划线的跨表查询,聚合查询和分组查询,F查询与Q查询. 比如我们有如下一张表,在model中 ...

  5. 从零开始的全栈工程师——js篇2.12(面向对象)

    面向对象 Js一开始就是写网页特效,面向过程的,作者发现这样写不好,代码重复利用率太高,计算机内存消耗太大,网页性能很差. 所以作者就收到java和c的影响,往面向对象靠齐.Js天生有一个Object ...

  6. LESS CSS非常实用实例应用

    @charset "UTF-8"; @base-color:#333; // 圆角 .border-radius (@radius: 5px) { -webkit-border-r ...

  7. spring-framework-3.0.2RELEASE之后为啥没有依赖包了?

    缘起:莫莫接到新任务要学习spring mvc,于是在网上找了个demo文档跟着一起做.这个是学习的网址: http://www.open-open.com/doc/view/a6462d9a2e2b ...

  8. Android各大手机系统打开权限管理页面

    最近项目上比较忙,终于有空闲时间写写东西了. 相信做过Android的都知道,现在的手机系统五花八门,当我们去请求用户的权限的时候,总是会弹出是否允许的对话框. 而且用户一旦不小心点了拒绝,下次就不再 ...

  9. 定制Banner

    1.修改Banner (1)在SpringBoot启动的时候会有一个默认启动的图案 (2)在src/main/resources下新建一个banner.txt (3)通过http://patorjk. ...

  10. SpringBoot的特性

    SpringBoot的理念“习惯优于配置” 习惯优于配置(项目中存在大量的配置,此外还内置了一个习惯性的配置,无须手动进行配置) 使用SpringBoot可以方便地创建独立运行.准生产级别的基于Spr ...