結果

問題 No.162 8020運動
ユーザー latte0119latte0119
提出日時 2015-03-06 00:28:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 874 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 61,836 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 15:25:01
合計ジャッジ時間 1,539 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
4,376 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
    double dp[21][32];
    int n;
    double p0,p1,p2;
    cin>>n>>p0>>p1>>p2;
    p0=(100-p0)/100;p1=(100-p1)/100;p2=(100-p2)/100;
    for(int j=0;j<32;j++){
        if(j%16==0||j%16==15)dp[n-60][j]=0;
        else dp[n-60][j]=1.0;
    }
    for(int i=n-60+1;i<=20;i++){
        for(int j=0;j<32;j++){
            if(j%16==0||j%16==15)dp[i][j]=0;
            else{
                dp[i][j]=dp[i-1][j]*dp[i-1][j-1]*dp[i-1][j+1]*p2;
                dp[i][j]+=dp[i-1][j]*dp[i-1][j-1]*(1-dp[i-1][j+1])*p1;
                dp[i][j]+=dp[i-1][j]*(1-dp[i-1][j-1])*dp[i-1][j+1]*p1;
                dp[i][j]+=dp[i-1][j]*(1-dp[i-1][j-1])*(1-dp[i-1][j+1])*p0;
            }
        }
    }
    double sum=0;
    for(int i=0;i<32;i++)sum+=dp[20][i];
    cout<<fixed<<sum<<endl;
}
0