結果

問題 No.813 ユキちゃんの冒険
ユーザー chocoruskchocorusk
提出日時 2019-04-12 22:38:08
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,017 bytes
コンパイル時間 2,976 ms
コンパイル使用メモリ 96,552 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 13:28:19
合計ジャッジ時間 2,736 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 7 ms
4,380 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 14 ms
4,380 KB
testcase_05 AC 22 ms
4,380 KB
testcase_06 AC 11 ms
4,380 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 83 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 44 ms
4,380 KB
testcase_13 AC 9 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 74 ms
4,376 KB
testcase_16 AC 14 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 79 ms
4,376 KB
testcase_20 AC 5 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 138 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; double p, q; cin>>n>>p>>q;
    double ans=0;
    double dp[2][2][1003]={};
    dp[0][0][1]=1;
    for(int i=1; i<=5000; i++){
        fill(dp[0][i&1], dp[0][i&1]+n+2, 0);
        fill(dp[1][i&1], dp[1][i&1]+n+2, 0);
        for(int j=1; j<=n; j++){
                dp[1][i&1][j-1]+=p*dp[0][(i&1)^1][j];
                dp[0][i&1][j+1]+=q*dp[0][(i&1)^1][j];
                dp[1][i&1][j-1]+=q*dp[1][(i&1)^1][j];
                dp[0][i&1][j+1]+=p*dp[1][(i&1)^1][j];
        }
        ans+=dp[1][i&1][0];
    }
    cout<<ans<<endl;
    return 0;
}
0