#include using namespace std; #define DUMP(x) cerr << #x << "=" << x << endl #define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("< >(x) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define REP(i,m,n) for (int i=m;i<(int)(n);i++) #define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h)) #define ALL(a) (a).begin(),(a).end() typedef long long ll; const int INF = 1e9; const ll INFLL = 1e18; typedef pair PII; int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1}; class TimeCheck { public: TimeCheck(int _limit) : limit(_limit) {} void start() { start_at = std::chrono::system_clock::now(); } bool check() { auto end_at = std::chrono::system_clock::now(); double elapsed = std::chrono::duration_cast(end_at - start_at).count(); return (elapsed < limit); } private: std::chrono::system_clock::time_point start_at; int limit; }; int main() { ios::sync_with_stdio(false); int K; cin >> K; random_device rand_dev; mt19937 rand_mt(rand_dev()); uniform_int_distribution dice(1, 6); ll step_sum = 0, ok_num = 0; TimeCheck time(4900); time.start(); while (time.check()) { int sum = 0, cnt = 0; while (sum != K) { sum += dice(rand_mt); cnt++; if (sum > K) sum = 0; } step_sum += cnt; ok_num++; #ifdef DEBUG cerr << cnt << endl; #endif } cout << (double)step_sum / ok_num << endl; }