#include #define rep(i, l, n) for (int i = (l); i < (n); i++) using namespace std; using std::chrono::duration_cast; using std::chrono::milliseconds; using std::chrono::system_clock; inline int getnow() { return duration_cast(system_clock::now().time_since_epoch()).count(); } //モンテカルロ法(精度は良くない) int main(void) { int stime = getnow(); int n; cin >> n; double p; cin >> p; if (n >= 200) { cout << 1 << endl; return 0; } int cnt = 0; int a = 0; while (getnow() - stime < 1900) { cnt++; bool flag = false; rep(i, 0, n) { double r = double(rand()) / double(RAND_MAX); if (r < p) { flag = true; break; } } if (flag) { a++; } } double ans = double(a) / double(cnt); cout << ans << endl; return 0; }