Charles Explorer logo
🇬🇧

Arithmetic mean of the sequence

Publication at Faculty of Mathematics and Physics |
2019

Abstract

The article from the series dedicated to problems of Mathematical Olympiad - category P (programming) discusses different solutions of one competition problem from the regional round of the 2013/14 school year. The task is to find in a sequence of numbers the longest continuous section whose arithmetic mean is equal to the specified value.

The article demonstrates various programming techniques that can be used to increase the time efficiency of a solution, such as pre-calculation, prefix sums, or appropriate data sorting. Besides the detailed analysis of the problem, we find in the article three basic variants of the solution written in the form of a sample program.