#include #define ONLINE_JUDGE using namespace std; int N, K; int A[100]; vector av; void readInput() { int i; cin >> N >> K; for (i = 0; i < N; i++) { cin >> A[i]; } } int main() { /* ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout.precision(2); */ av.clear(); #ifdef ONLINE_JUDGE freopen("temperatures.in", "r", stdin); freopen("temperatures.out", "w", stdout); #endif // ONLINE_JUDGE readInput(); int i, j, sum; double curAv, ans; for (i = 0; i <= N - K; i++) { sum = 0; for (j = i; j < i + K; j++) { sum = sum + A[j]; } curAv = double(sum) / double(K); av.push_back(curAv); } sort(av.begin(), av.end()); ans = av.back() - av[0]; printf("%.2f\n", ans); return 0; }