結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 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 <iostream>
#define REP(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,a) REP(i,0,a)
using namespace std;

int A;
double P0,P1,P2,U[20][14];

int main(void){
    cin >> A;
    cin >> P0 >> P1 >> P2;
    P0 /= 100.0, P1 /= 100.0, P2 /= 100.0;
    P0 = 1.0-P0, P1 = 1.0-P1, P2 = 1.0-P2;

    rep(i,14) U[0][i] = 1.0;
    
    REP(i,1,80-A+1) {
        U[i][ 0] = (P1*U[i-1][ 1] + P0*(1.0-U[i-1][ 1])) * U[i-1] [0];
        U[i][13] = (P1*U[i-1][12] + P0*(1.0-U[i-1][12])) * U[i-1][13];
        REP(j, 1, 13) {
            U[i][j] = (P2 * U[i-1][j-1]*U[i-1][j+1] + 
                       P1 * (U[i-1][j-1]*(1.0-U[i-1][j+1]) + (1.0-U[i-1][j-1])*U[i-1][j+1]) +
                       P0 * (1.0-U[i-1][j-1])*(1.0-U[i-1][j+1])) * U[i-1][j];
        }
    }

    double ans = 0.0;
    rep(i,14) ans += 2*U[80-A][i];
    printf("%.10f",ans);
}
0