Conception: Keep a k length slide window.

```
double findMaxAverage(vector<int>& nums, int k)
{
double max = -10000.0;
double sum = 0.0;
int last = 0;
for (int i = 0; i < nums.size(); ++i)
{
sum += nums[i];
if (i < k - 1)
continue;
double t = sum / k;
max = t>max ? t : max;
sum -= nums[last++];
}
return max;
}
```