Rational Monkey

There lived a wise monkey in the forest of Amazon. One day he started searching the jungle for bananas as he was very hungry. Suddenly he saw a line of nnn banana trees (numbered from 1 to n). He was very wise that’s true but he was a bit lazy as well. For that reason, he decided that he would collect bananas from exactly xxx banana trees and the difference of position between any two trees among these chosen x trees should be less than kkk. He collected all bananas of those xxx banana trees.

This is a companion discussion topic for the original entry at https://toph.co/p/rational-monkey