結果
問題 | No.2461 一点張り |
ユーザー |
![]() |
提出日時 | 2023-09-08 21:22:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 534 bytes |
コンパイル時間 | 4,197 ms |
コンパイル使用メモリ | 252,148 KB |
最終ジャッジ日時 | 2025-02-16 19:30:55 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ int _t; cin>>_t; rep(_,_t){ long double p; cin>>p; int K; cin>>K; long double c = 1.0; long double ans = 0.0; for(int i=1;i<=K;i++){ ans += c*p*i; c *= 1.0-p; } ans += c*K; cout<<fixed<<setprecision(15)<<ans<<endl; } return 0; }