1027. Colors in Mars (20)
来源:互联网 发布:工信部 数据分析师 编辑:程序博客网 时间:2024/05/17 08:30
- Colors in Mars (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
#include<stdio.h>char swit(int x){ switch(x){ case 10:return 'A'; case 11:return 'B'; case 12:return 'C'; default:return x+'0'; }}void transfer(int x,char* c){ int t=x/13; c[0]=swit(t); t=x%13; c[1]=swit(t); c[2]='\0';}int main(){ int a,b,c; scanf("%d %d %d",&a,&b,&c); char s1[3],s2[3],s3[3]; transfer(a,s1);transfer(b,s2);transfer(c,s3); printf("#%s%s%s\n",s1,s2,s3); return 0; }
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 1027. Colors in Mars (20)
- 安装win7旗舰版,一直卡在安装程序正在检测视频性能
- WebRTC VoiceEngine使用简单Demo
- servlet (2) HttpServletRequest 和HttpServletResponse
- 智慧中国杯百万大奖赛解读 | 精准资助机器学习(三)
- CentOS系统 定时运行脚本配置
- 1027. Colors in Mars (20)
- 关于AlarmManager设置重复闹钟延迟的问题
- quick-lua新建一个HelloWorld的项目并且编译Android版本
- vs Release 断点单步调试。
- OpenStack(kilo)界面dashboard的二次开发(二)-增加PanelGroup
- 从文件 I/O 看 Linux 的虚拟文件系统
- CSS3 选择器
- 锁机制学习笔记
- Linux平台下WebRTC音视频获取(Javascript API)