結果
問題 |
No.66 輝け☆全国たこやき杯
|
ユーザー |
![]() |
提出日時 | 2014-11-14 00:27:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 942 bytes |
コンパイル時間 | 656 ms |
コンパイル使用メモリ | 80,000 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 10:23:53 |
合計ジャッジ時間 | 1,288 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <iostream> #include <sstream> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> #include <cstring> #include <cmath> #include <cstdlib> #include <stack> #include <queue> #include <numeric> #include <ctime> using namespace std; double dp[11][1024]; double p[1024]; int main(){ int k; cin >> k; for(int i = 0; i < pow(2, k); i++){ cin >> p[i]; } int n = pow(2, k); int b = 2; for(int i = 0; i < n; i++){ dp[0][i] = 1.0; } for(int i = 0; i < k; i++){ for(int j = 0; j < n; j += b){ for(int t = j; t < j + b / 2; t++){ for(int s = j + b / 2; s < j + b; s++){ dp[i+1][t] += (p[t]*p[t] / (p[t]*p[t]+p[s]*p[s])) * dp[i][s] * dp[i][t]; dp[i+1][s] += (p[s]*p[s] / (p[t]*p[t]+p[s]*p[s])) * dp[i][s] * dp[i][t]; } } } b *= 2; } cout << dp[k][0] << endl; return 0; }