/* -*- coding: utf-8 -*- * * 65.cc: No.65 回数の期待値の練習 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_K = 20; /* typedef */ /* global variables */ double es[MAX_K + 6]; /* subroutines */ /* main */ int main() { int k; cin >> k; for (int i = 0; i < k + 6; i++) es[i] = 0.0; for (int i = k - 1; i >= 0; i--) { double sum = 0; for (int j = 1; j <= 6; j++) sum += es[i + j]; es[i] = 1.0 + sum / 6; } printf("%.5lf\n", es[0]); return 0; }