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
分析:进制转换,水题
/** * Copyright(c) * All rights reserved. * Author : Mered1th * Date : 2019-02-24-01.17.09 * Description : A1027 */ #include<cstdio> #include<cstring> #include<iostream> #include<cmath> #include<algorithm> #include<string> #include<unordered_set> #include<map> #include<vector> #include<set> using namespace std; ; int main(){ #ifdef ONLINE_JUDGE #else freopen("1.txt", "r", stdin); #endif ; ]={"0123456789ABC"}; printf("#"); while(k--){ scanf("%d",&n); printf(],c[n%]); } ; }
1027 Colors in Mars (20 分)的更多相关文章
- PAT 甲级 1027 Colors in Mars (20 分)(简单,进制转换)
1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way ...
- 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 ...
- PAT Advanced 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- PAT (Advanced Level) Practice 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- 1027 Colors in Mars (20 分)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- 【PAT甲级】1027 Colors in Mars (20 分)
题意: 输入三个范围为0~168的整数,将它们从十三进制转化为十进制然后前缀#输出. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include& ...
- 1027. Colors in Mars (20) PAT
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1027 简单题,考察十进制数和n进制数的转换和输出格式的控制. People in Mars rep ...
- PAT1027 Colors in Mars (20分) 10进制转13进制
题目 People in Mars represent the colors in their computers in a similar way as the Earth people. That ...
- 1027 Colors in Mars (20)
#include <stdio.h> #include <map> using namespace std; int main() { int R,G,B,i; map< ...
- PAT (Advanced Level) 1027. Colors in Mars (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...
随机推荐
- [转]TFS.VisualStudio.com TF30063: You are not authorized to access Collection
If you are trying to connect to team foundation server online through visual studio and you get unau ...
- 接下来将介绍C#如何设置子窗体在主窗体中居中显示,本文提供详细的操作步骤,需要的朋友可以参考下
接下来将介绍C#如何设置子窗体在主窗体中居中显示,本文提供详细的操作步骤,需要的朋友可以参考下 其实表面上看是很简单的 开始吧,现在有两个窗体Form1主窗体,Form2子窗体 而且我相信大部分人都会 ...
- ifstream 和 ofstream 用法。
outfile << pContent;//不可以用这个,因为不能写完全,比如遇到字符串中出现/0就终止了 bool CTestEn_DecryptDLLDlg::WriteDataFil ...
- css汇总
1.居中 parentElement{ display:flex;/*Flex布局*/ display: -webkit-flex; /* Safari */ align-items:center;/ ...
- 步步入佳境---UI入门(2)
一,刚开始练习UI的时候,一般是在- (void)viewDidLoad方法中写代码测试,例如:- (void)viewDidLoad{ CGRect rect=CGRectMake(0, 0, ...
- [Algorithm] A nonrecursive algorithm for enumerating all permutations of the numbers {1,2,...,n}
def permutationN(n): a=[None]*n for i in range(n): a[i]=i+1 sum=1 for j in range(n): sum*=(j+1) i=0 ...
- 杭电OJ1789、南阳OJ236(贪心法)解题报告
杭电OJ1789http://acm.hdu.edu.cn/showproblem.php?pid=1789 南阳OJ236http://59.69.128.203/JudgeOnline/probl ...
- test20180922 世界第一的猛汉王
题意 分析 由于异色点必有连边,所以一个点的covered减去两个点共有的covered就是可存在的环数,十分巧妙. 代码 #include <bits/stdc++.h> using L ...
- 内核启动卡在 Starting kernel ...
一.有时log是这样的 Card did not respond to voltage select! bytes read ms (39.8 MiB/s) bytes read ms (13.4 M ...
- commonJS规范基本结构
commonJS规范:使用 module.exports 和 require ,基本结构如下: // foo.js 输出模块 module.exports = function(x) { consol ...