結果
問題 |
No.2461 一点張り
|
ユーザー |
![]() |
提出日時 | 2024-10-21 23:40:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 489 bytes |
コンパイル時間 | 2,010 ms |
コンパイル使用メモリ | 193,292 KB |
最終ジャッジ日時 | 2025-02-24 22:14:34 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ld = long double; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int T; cin >> T; while(T--){ int K; ld p, ans=0, q, r, s=1; cin >> p >> K; r = p; q = 1.l-p; for (int i=1; i<K; i++){ ans += r*i; s -= r; r *= q; } ans += K*s; cout << setprecision(18) << ans << endl; } return 0; }