#include #include using namespace std; int main(){ int N, K; string jewelry; cin >> N >> K >> jewelry; int blue_gem = 0; for(int i = 0; i < K; i++){ blue_gem += jewelry[i] - '0'; } double ans = 0; bool if_retrieval[N]; for(int i = 0; i < N; i++){ if_retrieval[i] = true; } for(int i = 0; i < N; i++){ if(!if_retrieval[i]){ continue; } blue_gem -= jewelry[(i - 1 + N) % N] - '0'; blue_gem += jewelry[(i + K - 1 + N) % N] - '0'; int blue_gem_plus = 0; for(int j = 1; j + K - 1 < N; j++){ if(jewelry[(i - j + N) % N] == '0'){ break; } blue_gem_plus++; if_retrieval[(i - j + N) & N] = false; } int plus_i = 0; for(int j = 1; j + K - 1 < N; j++){ if(jewelry[(i + K + j - 1 + N) % N] == '0'){ break; } blue_gem_plus++; plus_i++; if_retrieval[(i + j) & N] = false; } i += plus_i; double ans_tmp = (blue_gem_plus + blue_gem) / double(blue_gem_plus + K); if(ans < ans_tmp){ ans = ans_tmp; } } cout << setprecision(10) << ans << endl; }