結果
問題 |
No.813 ユキちゃんの冒険
|
ユーザー |
![]() |
提出日時 | 2019-04-14 10:31:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 967 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 637 ms |
コンパイル使用メモリ | 73,960 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-21 08:30:20 |
合計ジャッジ時間 | 7,328 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int main() { int n; cin >> n; double p, q; cin >> p >> q; double x[1002][2] = {}; x[0][0] = 1; x[n + 1][1] = 0; for (int i = 1; i <= n; i++) { x[i][0] = 0.5; } for (int h = 0; h < 100000; h++) { for (int i = 1; i <= n; i++) { x[i][0] = q * x[i - 1][0] + p * x[i + 1][1]; x[i][1] = p * x[i - 1][0] + q * x[i + 1][1]; } } printf("%.8f\n", x[1][1]); return 0; }