So far, there are many color models in different area. For screen display, the most popular model is RGB color model. A color in the RGB color model is described indicating how much of each of the red, green, and blue is included. So one can easily determined a color by an RGB triplet (r, g, b). But there are other representation of the points in RGB color model,HSL and HSV are the two most popular representations among them and widely used in color pickers and in image editing software. They also use a triple (h,s,l) or (h,s,v) to determine a color but each component are with different meanings. each channel in HSL stands for hue, saturation, and lightness and in HSV stands for hue, saturation, and value. Note that while "hue" in HSL and HSV refers to the same attribute, their definitions of "saturation" differ dramatically.

For RGB triplet, we use digital 8-bit per channel notation, so the r,g,b can vary from 0 to 255. If all the components are at zero the result is black; if all are at maximum, the result is the brightest representable white.

For HSV and HSL, the hue channel is in unit of degrees, its value vary from 0 to 360(exclusive), and the saturation, lightness and value channel use percentage notation and their value vary from 0% to 100%.

For more detail about the RGB model and these representations, you can refer to HERE .

The problem here is ask you to implement a color representation conversion procedure to convert the representation between RGB,HSL and HSV following the methods below. Or you can find more detail of the converting method in HERE .

**Converting HSV to RGB**

Given a color with hue *H* ∈ [0°, 360°), saturation
*S*_{HSV} ∈ [0, 1], and value *V* ∈ [0, 1], we first find chroma:

Then we can find a point
(*R*_{1}, *G*_{1}, *B*_{1}) along the bottom three faces of the RGB cube, with the same hue and chroma as our color (using the intermediate value
*X* for the second largest component of this color):

Finally, we can find *R*, *G*, and *B* by adding the same amount to each component, to match value:

**Converting HSL to RGB**

Given an HSL color with hue *H* ∈ [0°, 360°), saturation
*S*_{HSL} ∈ [0, 1], and lightness *L* ∈ [0, 1], we can use the same strategy. First, we find chroma:

Then we can, again, find a point
(*R*_{1}, *G*_{1}, *B*_{1}) along the bottom three faces of the RGB cube, with the same hue and chroma as our color (using the intermediate value
*X* for the second largest component of this color):

Finally, we can find *R*, *G*, and
*B* by adding the same amount to each component, to match lightness:

**Convert RGB to HSL and HSV**

First unify (*r*, *g*, *b*) into a number between 0 and 1. Let
*max* equals to the maximum value in *r*, *g* and *b*. Let
*min* equals to the minimum value in *r*, *g* and *b*. The HSL is with hue *h* ∈ [0°, 360°), saturation
*s* ∈ [0, 1], and lightness *l* ∈ [0, 1]

When *max* = *min*, *h* is defined as 0.

HSL and HSV have the same definition of hue. The *s* and *v* value in HSV is defined as follows：

There are multiple cases in input. The first line of each case is name of the target representation which you need to convert to. The second line is the representation of the color. It could one of the RGB representation "RGB
`r` `g` `b`"(0 ≤
`r`,`g`,`b` ≤ 255), or HSL representation "HSL `h` `s`%
`l`%"(0 ≤ `h` < 360; 0 ≤ `s`, `l` ≤ 100), or HSV representation "HSV
`h` `s`% `v`%"(0 ≤ `h` < 360; 0 ≤ `s`,
`v` ≤ 100). Please note that all numeric value is integer.

提交代码