Description
You are given the results of a range function where every element has been rounded down to the nearest whole number. Your goal is to recover the original list.
For example, the following function (in Python3) will produce an input for your program:
from numpy import arange, floor
def floored_range(A, B, C):
return list(floor(arange(A, B, C)))
The output of your program should be a valid guess of the original data. Here, valid guess means that it must exactly match the input when floored and it must be a possible output of a range function (ie, when graphed it must form a perfectly straight line).
Examples
Input: [1,2,3,4]
Output: [1,2,3,4]
Input: [1,2,3,4]
Output: [1.9,2.7,3.5,4.3]
Input: [1,2,3,4,5,5]
Output: [1.9,2.7,3.5,4.3,5.1,5.9]
Input: [1,1,2,2,3,3,4,4]
Output: [1,1.5,2,2.5,3,3.5,4,4.5]
Input: [1,1,2,3,3,4]
Output: [1,1.7,2.4,3.1,3.8,4.5]
Input: [56, 54, 52, 50, 48, 45, 43, 41, 39, 37, 35, 32, 30, 28, 26, 24, 22, 19, 17, 15, 13, 11]
Output: [56.7 , 54.541, 52.382, 50.223, 48.064, 45.905, 43.746, 41.587,
39.428, 37.269, 35.11 , 32.951, 30.792, 28.633, 26.474, 24.315,
22.156, 19.997, 17.838, 15.679, 13.52 , 11.361]
A, B, C
can be any three floats. The input floored range can, for example, start at56.7
, end at10.2
and have a step size of-2.159
. The only thing that matters is that the points you output, when floored, exactly match the input. I've added an example showing that. \$\endgroup\$