結果
問題 | No.2461 一点張り |
ユーザー |
![]() |
提出日時 | 2023-09-08 22:08:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 329 bytes |
コンパイル時間 | 1,910 ms |
コンパイル使用メモリ | 191,852 KB |
最終ジャッジ日時 | 2025-02-16 19:53:12 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
#include<bits/stdc++.h> using namespace std; void solve(){ double p; cin >> p; int k; cin >> k; double now = 1; double ans = 0; for(int i=1; i<k; i++){ ans += now * p * i; now *= 1 - p; } ans += now * k; cout << fixed << setprecision(15); cout << ans << '\n'; } int main(){ int t; cin >> t; while(t--) solve(); }