//#define _USE_MATH_DEFINES //M_PI #include //std::cout, std::cin //#include //std::string //#include //std::vector //#include //std::valarray 数値のみの一次配列 //#include //std::sort //#include //localtime_s //#include //abs #include //abs, std::pow, sqrt, sin, cos, //#include //std::ifstream //#include //std::setprecision //#include //std::random(C++11) void Count_Hit(int N, int target, int *sum, int *hit) { for (int i = 0; i < 6; i++) { *sum = *sum + 1; if (N == 1) { if (target == *sum) { *hit = *hit + 1; } } else { Count_Hit(N - 1, target, sum, hit); *sum = *sum - 6 * (N - 1); } } } int main(void) { //test用 //std::ifstream in("test.txt"); //std::cin.rdbuf(in.rdbuf()); int N = 0; std::cin >> N; double ans = 0; int sum, hit; for (int i = 1; i <= 6*N; i++) { sum = 0; hit = 0; Count_Hit(N, i, &sum, &hit); ans += i*hit / std::pow(6, N); } std::cout << ans << std::endl; }