#P7106. 双生独白
双生独白
Background
I like quietness, you love noise; I stay loyal to warmth, you are crazy about coolness.
If everything has an opposite, then what about the colors that piece this world together?
Is it only white and black?
Problem Description
To formally describe colors, we introduce the RGB color value, using a triple to represent a color, where are the R value, G value, and B value of the color, respectively. They satisfy and are all decimal integers.
Obviously, this color system can represent different colors in total. For a color , define its inverse color RGB value as .
However, people found that using RGB values directly is inconvenient, because copying a color requires copying three values.
So the hex color code was created, which is a string of length like #EBA932. Specifically:
- The first character of the string is
#, which is the color code identifier. - The second and third characters are hexadecimal digits. The hexadecimal number formed by them equals the R value of the color in decimal.
- The fourth and fifth characters are hexadecimal digits. The hexadecimal number formed by them equals the G value of the color in decimal.
- The sixth and seventh characters are hexadecimal digits. The hexadecimal number formed by them equals the B value of the color in decimal.
Hexadecimal digits, from small to large, include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Note that A, B, C, D, E, F must all be uppercase.
Now you are given a hex color code. Please output the hex color code of its inverse color.
Hint: The RGB value of a color and its hex code can be converted to each other (see sample explanation #2).
Input Format
One line: a string of length , representing the hex color code of the original color.
Output Format
One line: a string of length , representing the hex color code of the inverse color.
#FFFFFF
#000000
#EBA932
#1456CD
Hint
[Sample Explanation #1]
After conversion, the RGB value of the original color is , and the RGB value of the inverse color is , which corresponds to the hex code #000000.
[Sample Explanation #2]
After conversion, the RGB value of the original color is , and the RGB value of the inverse color is , which corresponds to the hex code #1456CD.
To avoid misunderstanding, here is a special explanation of why the B value after converting #EBA932 is : take the sixth and seventh characters of the string to form the hexadecimal number , then .
[Constraints]
This problem has 10 test points. For each test point you pass, you can get 10 points.
For of the testdata, it is sample #1.
For another of the testdata, neither the input string nor the output string contains uppercase letters.
For all testdata, it is guaranteed that the given string is a valid hex color code.
Translated by ChatGPT 5