結果
| 問題 |
No.813 ユキちゃんの冒険
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-14 23:37:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 406 bytes |
| コンパイル時間 | 718 ms |
| コンパイル使用メモリ | 69,376 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 07:06:27 |
| 合計ジャッジ時間 | 1,447 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 3 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cstring>
using namespace std;
int N;
double P, Q;
double dp[1010];
int main() {
cin >> N >> P >> Q;
if (N == 1) {
printf("%.15f\n", P);
return 0;
}
dp[N - 1] = Q;
for (int i = N - 2; i >= 0; i--) {
dp[i] = P + Q * dp[i+1] * Q / (1 - dp[i+1]*P);
}
printf("%.15f\n", dp[0]);
}