結果

問題 No.813 ユキちゃんの冒険
ユーザー pekempey
提出日時 2019-06-30 17:34:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 69,128 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 07:10:32
合計ジャッジ時間 1,412 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#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] = Q;
  for (int i = N - 1; i >= 0; i--) {
    dp[i] = P + Q * dp[i+1] * Q / (1 - dp[i+1]*P);
  }
  printf("%.15f\n", dp[0]);
}
0