A weather station logs a batch of raw sensor readings before they can be published. The manufacturer has supplied a single linear calibration formula, f(x) = m * x + c, and every raw reading must be replaced by its calibrated value using that same formula, in the same order the readings were recorded.
The first line contains three space-separated integers n, m, and c — the number of readings and the two calibration constants. The second line contains n space-separated integers a_1, a_2, ..., a_n — the raw readings. This line is empty (or omitted) when n = 0.
Print n space-separated integers on a single line: the calibrated readings f(a_1), f(a_2), ..., f(a_n), in the original order. Print an empty line when n = 0.
Example 1
Input
5 2 3 1 2 3 4 5
Expected
5 7 9 11 13
Explanation
f(x) = 2x + 3. Applying it to each reading gives 2*1+3=5, 2*2+3=7, 2*3+3=9, 2*4+3=11, 2*5+3=13, so the output is 5 7 9 11 13.
Example 2
Input
3 -1 0 4 -2 0
Expected
-4 2 0
Explanation
f(x) = -1*x + 0 = -x. Negating each reading gives -4, 2, 0, so the output is -4 2 0.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →