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. 4-Three-Matterhorn man

    What was the main objective of early mountain climbers?   ①Modern alpinists try to climb mountains b ...

  2. hosts文件介绍

    在Window系统中有个Hosts文件(没有后缀名),在Windows98系统下该文件在Windows目录,在Windows2000/XP系统中位于C:\Winnt\System32\Drivers\ ...

  3. 【AI】微软人工智能学习笔记(一)

    数据分析平台 01|数据平台概况图示 上面图中所示就是微软人工智能数据平台的相关的技术. 02.1| Cortana Intelligence Suite 从上面图中可以看到, 其中有一个Cortan ...

  4. Latex: 添加IEEE论文keywords

    参考: How to use \IEEEkeywords Latex: 添加IEEE论文keywords 方法: \begin{IEEEkeywords} keyword1, keyword2. \e ...

  5. js为什么返回两个对象字符串 objcet objcet ?

    js中两个使用 toString() 对有个有对象的数组进行操作时,为什么返回两个对象字符串 objcet objcet ? [{}].toString(); 返回 "[object Obj ...

  6. 20165306 预备作业3 Linux安装及学习

    查看了许多教程,VirtualBox和Ubuntu已安装完成.以下为学习Linux基础入门课程的实验报告.实验截图.尚未解决的问题及体会. 实验三 用户及文件权限管理 一.Linux用户管理 (一)查 ...

  7. SSH KEY 设置 目录在open ~ 根目录下的.ssh 里面

    当我们从github或者gitlab上clone项目或者参与项目时,需要证明我们的身份.github.gitlab支持使用SSH协议进行免密登录,而SSH协议采用了RSA算法保证了登录的安全性.我们要 ...

  8. 使用phpmyadmin创建数据库

    1,使用phpmyadmin也需要实现安装php环境,安装环境请参考:http://www.sitestar.cn/bbs/thread-164-1-1.html: 2,到phpmyadmin官方网站 ...

  9. python win32api 如何用代码模拟点击网页confirm框的确定按钮

    mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)webBrowser1.Document.DomDocument; doc.parentWindo ...

  10. [jshint] 'import' is only available in ES6 (use 'esversion: 6'). (W119) 提示import等ES6语法的jshint错误的,在代码前加一行 /* jshint esversion: 6 */

    官方下载了vue的简单项目,用vscode打开main.js,代码前出现黄点,js报错了 把鼠标移至import的波浪线上,出现提示:W119 - ‘import’  is only availabl ...