結果
問題 |
No.2461 一点張り
|
ユーザー |
![]() |
提出日時 | 2023-09-11 15:51:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 514 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 40,960 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 05:57:06 |
合計ジャッジ時間 | 827 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
/* -*- coding: utf-8 -*- * * 2461.cc: No.2461 一点張り - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { double p; int k; scanf("%lf%d", &p, &k); double q = 1.0, e = 0.0; for (int i = 1; i < k; i++) { e += q * p * i; q *= 1.0 - p; } e += q * k; printf("%.11lf\n", e); } return 0; }