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. InnoDB锁笔记

    InnoDB主要使用行级锁(row lock),其行锁是通过在索引项上加锁而实现的,如果MySQL的执行计划没有用到索引,那么行锁也就无意义了 InnoDB的行锁是通过给索引上的索引(聚集,非聚集)添 ...

  2. 1st,Python基础——01

    1 Python介绍 2 Python发展史 3 Python2 or 3? 4 Python安装 就不写了,各路大牛的博客都很详细. 5 Hello World程序 #!/usr/bin/env p ...

  3. 全排列问题Ⅰ(Java实现)

    给定一个没有重复数字的序列,返回其所有可能的全排列. 示例: 输入: [1,2,3] 输出: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1 ...

  4. Jmeter 接口测试知识梳理——持续集成篇

    Jmeter 使用也有很长时间了,但是一直没有做一下知识梳理,近期会对公司同事做一下这方面的培训,借此机会,把使用过程中应用到的知识,或是遇到的问题,整理出来,方便大家学习! Jmeter + Ant ...

  5. js判断安卓客户端或者是ios客户端,是否是微信浏览器

      代码: function xaizai() {  var u = navigator.userAgent, app = navigator.appVersion;  var isAndroid = ...

  6. (8)进程---Queue队列

    # IPC Inter-Process Communication # 实现进程之间通信的两种机制: # 管道 Pipe 用的很少 # 队列 Queue 队列的特征:现进先出,栈属于后进后出 基本语法 ...

  7. 在不进入Guest OS的情况下,取得Guest OS的IP地址

    因为是个Headless 服务器,总是需要GUI VNC 到 Host OS, 然后进入里面的虚拟机,打 ipconfig / ifconfig  ,非常的不方便. 查了网上,找到上面的方法 1)确保 ...

  8. spring cloud: Hystrix(一):简单使用

    在微服务架构中,我们将系统拆分为很多个服务,各个服务之间通过注册与订阅的方式相互依赖,由于各个服务都是在各自的进程中运行,就有可能由于网络原因或者服务自身的问题导致调用故障或延迟,随着服务的积压,可能 ...

  9. 雷林鹏分享:C# 数组(Array)

    C# 数组(Array) 数组是一个存储相同类型元素的固定大小的顺序集合.数组是用来存储数据的集合,通常认为数组是一个同一类型变量的集合. 声明数组变量并不是声明 number0.number1... ...

  10. spring ----> 事务:传播机制和接口TransactionDefinition

    spring事务: 编程式事务(细粒度) 声明式事务(粗粒度,xml或者注解格式) spring接口TransactionDefinition: TransactionDefinition接口定义了事 ...