PAT甲级——A1027 Colors in Mars
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 <iostream>
#include <string>
using namespace std;
int main()
{
int a[];
string str = "0123456789ABC";
cin >> a[] >> a[] >> a[];
printf("#%c%c%c%c%c%c\n", str[a[] / ], str[a[] % ],
str[a[] / ], str[a[] % ], str[a[] / ], str[a[] % ]);
return ;
}
PAT甲级——A1027 Colors in Mars的更多相关文章
- 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 ...
- 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甲级——1027 Colors in Mars
1027 Colors in Mars People in Mars represent the colors in their computers in a similar way as the E ...
- PAT 甲级 1027 Colors in Mars
https://pintia.cn/problem-sets/994805342720868352/problems/994805470349344768 People in Mars represe ...
- A1027 Colors in Mars (20)(20 分)
A1027 Colors in Mars (20)(20 分) People in Mars represent the colors in their computers in a similar ...
- PAT A1027 Colors in Mars (20)
AC代码 #include <cstdio> const int max_n = 1000; int ans[max_n]; char result[max_n]; char radix[ ...
- A1027. Colors in Mars
People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...
- 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 甲级 1044 Shopping in Mars
https://pintia.cn/problem-sets/994805342720868352/problems/994805439202443264 Shopping in Mars is qu ...
随机推荐
- 实时检测网络状态及是否可以连接Internet
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
- spingboot linux 启动方式与脚本
java -jar XXX.jar java -jar xxx.jar & 区别:前台启动ctrl+c就会关闭程序,后台启动ctrl+c不会关闭程序 java -jar xxx.jar > ...
- C++单纯的指针传参的问题
C++指针传参也是单纯的复制一份地址,如下代码: #define _CRT_SECURE_NO_WARNINGS #include<iostream> using namespace st ...
- hudson通过ant自动编译、启动、停止java的jar
set ANT_PATH=E:\soft\apache_ant\bine:cd E:\data\codex\server\trunk\serversvn up @echo.@echo.@echo &q ...
- linux普通用户无法登录mysql
一.前言 本帖方法只适用于普通用户无法登录,但root用户可以登录的情况. 今天将war包放入linux后,运行报错,经过检查发现是数据库连接不上.奇怪的是,用户名和密码都是正确的,所以有了以下发现. ...
- POJ1160 Post Office-四边形不等式优化DP
方程 $\Large f(i,j)=min(f(i-1,k)+w(k+1,j))$ 其中$w(i,j)$表示在$[i,j]$的村庄都去一个邮局的最小距离和 证明w满足四边形不等式 设$w_k(i,j) ...
- 线段树动态开点——cf1045G
只计算半径小的能看到的半径大的,因为如果计算半径大的看到半径小的,虽然q在其范围内,但是小的不一定能看到大的 那么我们将机器人按照半径降序排序 遍历一次,去查询在[x-r,x+r]范围的,智商在[q- ...
- springmvc jar包下载
(1) springmvc jar包下载 提供地址 - qq_31307253的博客 - CSDN博客https://blog.csdn.net/qq_31307253/article/details ...
- springboot与分布式(zookeeper+dubbo)
docker安装zookeeper命令: docker pull zookeeper:3.4.14 docker启动zookeeper命令: docker run --name zk01 -p 218 ...
- OpenCASCADE 平面与球面求交
OpenCASCADE 平面与球面求交 eryar@163.com OpenCASCADE提供了类IntAna_QuadQuadGeo用来计算两个二次曲面quadric(球面.圆柱面.圆锥面及平面,平 ...