Created
October 12, 2017 09:45
-
-
Save divadsn/36a3f4e1a50d43ab0668717e975c7b31 to your computer and use it in GitHub Desktop.
Codeforces solution for 808B
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
using namespace std; | |
int main() { | |
int n, k; | |
cin >> n >> k; | |
int sum = 0, m; | |
cin >> m; | |
sum += m; | |
if (n == 1) { | |
printf("%.10f\n", (double) sum); | |
return 0; | |
} | |
for (int i = 1; i < n - 1; i++) { | |
cin >> m; | |
sum += m * 2; | |
} | |
cin >> m; | |
sum += m; | |
double d = (double) sum / (n - k + 1); | |
printf("%.10f\n", d); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment