
Vancouver, 1982. The stock exchange launches an index at 1000 points and recomputes it thousands of times a day, truncating the result every single time instead of rounding it. Each recalculation quietly loses a sliver. Twenty two months later the index reads 524 while the market had actually gone up, and they have to stop everything and restate it to 1098. Round it properly.
Objective
Add up n divisions, each rounded to the nearest whole instead of truncated.
Steps
$ index_value({1,3}, {2,2}, 2)
3
$ index_value({5}, {3}, 1)
2
$ index_value({4}, {3}, 1)
1
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...