結果
問題 | No.2461 一点張り |
ユーザー |
![]() |
提出日時 | 2023-09-08 22:53:05 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 781 bytes |
コンパイル時間 | 12,763 ms |
コンパイル使用メモリ | 323,236 KB |
最終ジャッジ日時 | 2025-02-16 20:18:20 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
#include <bits/stdc++.h>using namespace std;using namespace chrono;#if __has_include(<atcoder/all>)#include <atcoder/all>using namespace atcoder;#endifint main(){int64_t T;cin >> T;for (int64_t t = 0; t < T; t++){long double p;int64_t k;cin >> p >> k;map<int64_t, long double> mp;auto f = [&](auto &&g, int64_t x) -> long double{if (mp.contains(x)){return mp[x];}if (k <= x){return mp[x] = 0;}long double ret = 1 + (1 - p) * g(g, x + 1);return mp[x] = ret;};cout << fixed << setprecision(20) << f(f, 0) << endl;}return 0;}