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. free online code editor

    free online code editor online vscode https://stackblitz.com/ https://codesandbox.io/ https://codesh ...

  2. taro table component

    taro table component https://juejin.im/post/5d901696f265da5b926bbcaa https://taro-ext.jd.com/search? ...

  3. 牛市下SPC新空投糖果来了

    2021年元旦刚过没几天,比特币就开启了牛市的旅程,比特币涨至三万四千美元,率领众多币种暴涨,一股浓浓的牛市味道来了. 虽然从昨天开始,比特币带领着主流币进行了一波调整,但是只涨不跌的市场是 大家说比 ...

  4. JVM必不可少的知识

    1.Java垃圾回收机制 对象被判断为垃圾的标准:没有被其他对象引用 2.判断对象是否可被回收 (1)引用计数算法 判断对象的引用数量 通过判断对象的引用数量来决定对象是否可以被回收 每个对象实例都有 ...

  5. [Python学习笔记]爬虫

    要使用Python 抓取网页,首先我们要学习下面四个模块: 包 作用 webbrowser 打开浏览器获取指定页面: requests 从因特网下载文件和网页: Beautiful Soup 解析HT ...

  6. Java并发之CompletionService详解

    CompletionService是什么? 它是JUC包中的一个接口类,默认实现类只有一个ExecutorCompletionService. CompletionService干什么的? 它将异步任 ...

  7. eclipse从接口快速跳转到实现类

    1.只跳转到实现类上 按住Ctrl键,把鼠标的光标放在要跳转的接口上面,选择第二个 2.直接跳转大实现的方法上 按住Ctrl键,把鼠标的光标放在要跳转的方法上面,选择第二个 对比可以发现,操作都是一样 ...

  8. eclipse输入时自动提示

    当输入一部分代码时,其他的候选代码提示出来,可以提高开发的效率,设置方法如下: 选择Window -> Perferences -> Java -> Editor -> Con ...

  9. PAT-1150(Travelling Salesman Problem)旅行商问题简化+模拟图+简单回路判断

    Travelling Salesman Problem PAT-1150 #include<iostream> #include<cstring> #include<st ...

  10. 面向青铜的java自学路线

    有经验的人都知道,java还是需要一些路线的,因为java有些知识前后关联挺大的,先学后面和先学前面难度是不一样的. 如果你是新手,只要你知道路线这个东西,起码要比别人强,至少知道可以怎么走(更重要的 ...