1027 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

题目大意:将输入的三个数分别转换为13进制,然后#输出,并且需要大写。

#include <stdio.h>
#include<iostream>
#include <algorithm>
using namespace std;
char a[];
int main() {
int b[];
for(int i=;i<;i++)
cin>>b[i];
for(int i=;i<;i++){
a[*i+]=(b[i]%>=)?'A'+(b[i]%-):b[i]%+'';
b[i]=b[i]/;
a[*i]=(b[i]%>=)?'A'+(b[i]%-):b[i]%+'';
}
cout<<'#';
for(int i=;i<;i++)
cout<<a[i]; return ;
}

//我真是醉了,我这一个简简单单的代码,居然提交了好几次。。完全都没考虑清楚。

b[i]被新赋值为/,而不是%13.。。判断的时候不是三元表达式出了问题,而是判断应该>=10.注意有=号!!!太马虎了,这是为什么呢?

最新文章

  1. .Net程序员之不学Java做安卓开发:Android Studio中的即时调试窗口
  2. HDU 4865 Peter&#39;s Hobby --概率DP
  3. Objective-C:Foundation框架-常用类-NSNumber
  4. BTREE与其它索引的优缺点对比
  5. Android学习之SharedPreferences类
  6. java(样品集成框架spring、spring mvc、spring data jpa、hibernate)
  7. 支付顺序--&gt;微信支付到公司账户--&gt;待出票
  8. Spring学习(17)--- 三种装配Bean方式比较
  9. feed 流数据请求时机的两个思路
  10. freemarker声明变量(十)
  11. Cisco banner 登陆消息提示设置命令详解
  12. 【Unity Shaders】Transparency —— 透明的cutoff shader
  13. jmeter5.1测试websocket接口
  14. zabbix使用客户端和不使用客户端监控指定端口
  15. macbook查找卸载pkg
  16. 《centos系列》配置vim编辑器
  17. luogu2048 [NOI2010]超级钢琴 (优先队列+主席树)
  18. check the manual that corresponds to your MySQL server version for the right syntax to use near
  19. Struts2学习笔记04 之 拦截器
  20. barba.js 优化页面跳转用户体验

热门文章

  1. 批量更改数据库表架构(生成sql后直接执行!)
  2. 使用__FILE__和__LINE__定位错误
  3. 【抓包分析】Charles和 夜神模拟器 对安卓应用进行抓包分析
  4. java基础----&gt;数组的基础使用(二)
  5. 【转】详解抓取网站,模拟登陆,抓取动态网页的原理和实现(Python,C#等)
  6. 23种设计模式之状态模式(State)
  7. lombok 转载
  8. block 的细节和本质
  9. Python开发环境搭建方法简述
  10. python转化字符串形式的json