結果

問題 No.813 ユキちゃんの冒険
ユーザー mtsdmtsd
提出日時 2019-04-12 22:21:28
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 507 bytes
コンパイル時間 3,385 ms
コンパイル使用メモリ 147,648 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 13:27:03
合計ジャッジ時間 5,246 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 6 ms
4,380 KB
testcase_02 AC 68 ms
4,376 KB
testcase_03 AC 54 ms
4,376 KB
testcase_04 AC 186 ms
4,380 KB
testcase_05 AC 174 ms
4,376 KB
testcase_06 AC 79 ms
4,380 KB
testcase_07 AC 21 ms
4,376 KB
testcase_08 AC 130 ms
4,376 KB
testcase_09 AC 14 ms
4,376 KB
testcase_10 AC 67 ms
4,376 KB
testcase_11 AC 48 ms
4,380 KB
testcase_12 AC 132 ms
4,380 KB
testcase_13 AC 104 ms
4,380 KB
testcase_14 AC 5 ms
4,380 KB
testcase_15 AC 161 ms
4,380 KB
testcase_16 AC 189 ms
4,376 KB
testcase_17 AC 29 ms
4,380 KB
testcase_18 AC 14 ms
4,380 KB
testcase_19 AC 184 ms
4,380 KB
testcase_20 AC 56 ms
4,376 KB
testcase_21 AC 26 ms
4,376 KB
testcase_22 AC 27 ms
4,376 KB
testcase_23 AC 92 ms
4,380 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)

int main(){
	int n;
	long double p,q;
	cin >> n >> p >> q;
	vector<long double> dp(2*n+2);
	dp[1] = 1.0;
	rep(zzz,10000){
		vector<long double> dp2(2*n+2);
		rep(i,2*n+1){
			if(i==0){dp2[i] += dp[i];continue;}
			if(i%2==1){
				dp2[i-1] += p*dp[i];
				dp2[i+2] += q*dp[i];
			}else{
				dp2[i+1] += p*dp[i];
				dp2[i-2] += q*dp[i];
			}
		}
		dp = dp2;
	}
	cout.precision(10);
	cout << dp[0] << endl;
	return 0;
}
0