#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) #define CLR(mat) memset(mat, 0, sizeof(mat)) typedef long long ll; random_device rnd; mt19937 mt(rnd()); uniform_int_distribution<> r(1,6); // 0 - 1 一様乱数 int main() { ios::sync_with_stdio(false); cin.tie(0); int K; cin >> K; int times = 1000000; int cnt = 0; FOR(i,0,times) { int sum = 0; while(sum != K) { sum += r(mt); if(sum > K) sum = 0; cnt++; } } cout << (double) cnt / times << endl; }