結果
| 問題 |
No.162 8020運動
|
| コンテスト | |
| ユーザー |
latte0119
|
| 提出日時 | 2015-03-06 00:28:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 874 bytes |
| コンパイル時間 | 541 ms |
| コンパイル使用メモリ | 61,416 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 09:49:26 |
| 合計ジャッジ時間 | 1,359 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 13 WA * 13 |
ソースコード
#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;
}
latte0119