#K59752. Adjust Image Brightness
Adjust Image Brightness
Adjust Image Brightness
In this problem, you are given an image pixel's color value represented by three integers (R, G, B). Your task is to adjust the brightness of the pixel by adding a given integer to each of these values. However, the pixel values need to be clamped within the range \(0 \leq x \leq 255\). That is, if the result exceeds 255, it should be set to 255; if it is below 0, it should be set to 0.
You are required to process multiple test cases where each test case consists of three integers representing the pixel's RGB values and a fourth integer representing the brightness adjustment.
inputFormat
The first line of input contains an integer \(T\) which indicates the number of test cases. Each of the following \(T\) lines contains four space-separated integers: \(R\), \(G\), \(B\) and \(X\) where \(R, G, B \in [0, 255]\) are the pixel's color values and \(X\) represents the brightness adjustment (may be positive, negative, or zero).
outputFormat
For each test case, output a single line containing three space-separated integers which are the adjusted \(R\), \(G\), and \(B\) values. Each value must be within the range \([0, 255]\).
## sample3
50 100 150 10
255 250 245 -10
0 0 0 50
60 110 160
245 240 235
50 50 50
</p>