PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642

题目描述:

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.

译:火星上的人们在电脑中表示颜色和地球人用相似的方式。那就是 颜色用一个6 位数表示,前 2 位表示红色,中间 2 位表示绿色,最后 2 位表示蓝色。 唯一的不同是,他们(火星人)使用 13 进制 (0-9 和 A-C) 而不是 16 进制。现在给你一个三个十进制数(在 0 - 168 之间)表示颜色,你应该输出火星上的 RGB 值。


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.

译:对于每个测试用例你应该用接下来的格式输出火星上的 RGB 值:首先输出 # 然后接着输出一个所有英文字符必须大写的 6 位数字。如果单个颜色只有 1 位数,你必须在它左边输出一个 0


Sample Input (样例输入):

15 43 71

Sample Output (样例输出):

#123456

The Idea:

直接干!最简单的题!!! 没有之一!!!


The Codes:

#include<bits/stdc++.h>
using namespace std ;
string str = "0123456789ABC" , ans = "#" ;
int main(){
int r , g , b ;
cin >> r >> g >> b ;
ans += str[r / 13] ; // 颜色第一位
ans += str[r % 13] ; // 颜色第二位
ans += str[g / 13] ;
ans += str[g % 13] ;
ans += str[b / 13] ;
ans += str[b % 13] ;
cout<< ans << endl ;
return 0 ;
}

PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642的更多相关文章

  1. PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642 题目描述: A number that will ...

  2. PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...

  3. PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642 题目描述: Given a non-negative integer N ...

  4. PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642 题目描述: Calculate a+b and output the sum i ...

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

  6. PAT (Advanced Level) Practice 1054 The Dominant Color (20 分)

    Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of i ...

  7. PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) (进制转换,回文数)

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

  8. PAT (Advanced Level) Practice 1005 Spell It Right (20 分) (switch)

    Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output e ...

  9. PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) (找最值)

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

随机推荐

  1. 动态规划算法 All In One

    动态规划算法 All In One dynamic programming leetcode https://leetcode.com/tag/dynamic-programming/ https:/ ...

  2. 三维码 & 二维码 & 一维码

    三维码 & 二维码 & 一维码 3D, 2D, 1D 防伪国家标准 -<结构三维码防伪技术条件> http://www.xinhuanet.com/tech/2019-12 ...

  3. js in depth: Object & Function & prototype & __proto__ & constructor & classes inherit

    js in depth: Object & Function & prototype & proto & constructor & classes inher ...

  4. dart 匹配基本map

    var map_start = RegExp(r'^\s*\{\s*'); var map_end = RegExp(r'^\}\s*(,)?\s*'); var hasComma = true; M ...

  5. jquery.query.js

    帮助文档 var url = location.search; > "?action=view&section=info&id=123&debug&te ...

  6. 如何成为NGK超级节点?

    NGK这个 "超级节点" 到底是什么?什么是超级节点呢? 区块链网络中的每一个节点,其实就是存储数据的每一台电脑或者服务器终端.节点要完成新区块的生产.交易的验证与记帐.因此节点之 ...

  7. 2021-02:Teams开发平台更新概述

    作为2021年工作计划的一部分,我会在每月的第三个星期五发布Teams开发平台的更新报告,给大家整理和讲解最新的平台功能,以及特色场景.这是第一篇文章,我会挑选截至到2月份一些重要的更新,以后每月的更 ...

  8. django学习-23.admin管理后台的数据表数据的自定义展示

    目录结构 1.前言 2.自定义设置一张指定的数据表的列表展示内容 2.1.第一步:如果我们想让数据表[hello_person]里面的表字段值全部展示出来,需在应用[hello]里的[admin.py ...

  9. 内核栈与thread_info结构详解

    本文转载自内核栈与thread_info结构详解 什么是进程的内核栈? 在内核态(比如应用进程执行系统调用)时,进程运行需要自己的堆栈信息(不是原用户空间中的栈),而是使用内核空间中的栈,这个栈就是进 ...

  10. 一文读懂Servlet

    1 Servlet简介 Servlet就是sun公司开发动态web的一门技术 Sun在这些API中提供一个接口叫做:Servlet. 开发一个Servlet程序,只需两步: 编写一个类,实现Servl ...