#C9556. Blending Colors
Blending Colors
Blending Colors
You are given two colors represented as RGB values and a blending ratio \( r \) (with \( 0 \le r \le 1 \)). The first color is given by \( (r_1, g_1, b_1) \) and the second by \( (r_2, g_2, b_2) \). The task is to compute a new color by blending these two colors.
The blended color \( (R, G, B) \) is computed using the formula:
\[ R = \text{round}(r \times r_1 + (1 - r) \times r_2), \quad G = \text{round}(r \times g_1 + (1 - r) \times g_2), \quad B = \text{round}(r \times b_1 + (1 - r) \times b_2) \]
The result should be printed as three integers separated by spaces.
inputFormat
The input consists of a single line containing seven numbers separated by spaces: the first six are integers representing the RGB values of the two colors (( r_1, g_1, b_1 ) and ( r_2, g_2, b_2 )), and the last is a floating-point number representing the blending ratio ( r ).
outputFormat
Output a single line with three integers representing the blended color's RGB values, separated by a space.## sample
100 150 200 50 100 150 0.75
88 138 188