1027 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 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<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxnum 100005 char s[] = {'A','B','C'}; int main(){ int a[];
for(int i=;i < ;i++) cin >> a[i];
cout << "#";
for(int i=;i < ;i++){
vector<char> vec;
if(a[i] == ){cout << "";continue;}
while(a[i]){
int num = a[i]%;
if(num < ){vec.push_back(num+'');}
else vec.push_back(s[num%]);
a[i] = a[i]/;
}
if(vec.size() == ) cout << ;
for(int i=vec.size()-;i >= ;i--){
cout << vec[i];
}
}
return ;
}

——再次注意0这个数据,在进制转换中一直会出。

 

PAT 1027 Colors in Mars的更多相关文章

  1. PAT 1027 Colors in Mars[简单][注意]

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

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

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

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

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

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

  6. PAT甲级——1027 Colors in Mars

    1027 Colors in Mars People in Mars represent the colors in their computers in a similar way as the E ...

  7. 1027 Colors in Mars (20 分)

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

  8. PTA (Advanced Level) 1027 Colors in Mars

    Colors in Mars People in Mars represent the colors in their computers in a similar way as the Earth ...

  9. 1027. Colors in Mars (20) PAT

    题目:http://pat.zju.edu.cn/contests/pat-a-practise/1027 简单题,考察十进制数和n进制数的转换和输出格式的控制. People in Mars rep ...

随机推荐

  1. watch监控,对比新值和旧值做出相应判断

    数据变化的监控经常使用,我们可以先来看一个简单的数据变化监控的例子.例如天气预报的穿衣指数,它主要是根据温度来进行提示的,当然还有其它的,咱们就不考虑了. html <div id=" ...

  2. 洛谷P2362 围栏木桩----dp思路

    在翻dp水题的时候找到的有趣的题0v0 原文>>https://www.luogu.org/problem/show?pid=2362<< 题目描述 某农场有一个由按编号排列的 ...

  3. SpringMVC+fastjson项目配置

    首先这个项目得是maven项目,不是maven项目的自己引包,我就不多说了. <!-- https://mvnrepository.com/artifact/org.springframewor ...

  4. 【BZOJ】3572: [Hnoi2014]世界树

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=3572 算是细节题了吧.. 构出虚树,考虑z正反DP两次求出虚树中每个点最近的议事处是哪一个 ...

  5. python3 items() 与 python2 中iteritems()的区别

    在Python2.x中, iteritems() 用于返回本身字典列表操作后的迭代 Python 3.x 里面, iteritems() 方法已经废除了,而 items() 得到的结果是和 2.x 里 ...

  6. 03-python-装饰器

    装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象.它经常用于有切面需求的场景,比如:插入日志.性能测试.事务处理.缓存.权 ...

  7. winfrom 动态添加控件,以及删除

      private void btnadd_Click(object sender, EventArgs e)         {             int fileCount = 0;     ...

  8. C#通过 “枚举数支持在指定类型的集合上进行简单迭代” 的概念获取List的一种方式

    using System; using System.Collections.Generic; using System.Linq; namespace myMethod { class Animal ...

  9. Inception网络

    2018-12-09 19:39:38 一.1 * 1卷积 pooling可以对feature map的height,width进行修改,但是对通道数目无法修改. 1 * 1卷积可以在不改变图像大小的 ...

  10. HTML 第十一章总结

    # 第十一章总结:本章的标题为:layout and positioning Arranging Element##前言:这一章节,通过已经知道的 box model 的概念,进行讲述关于 layou ...