結果
| 問題 | No.66 輝け☆全国たこやき杯 |
| コンテスト | |
| ユーザー |
sugim48
|
| 提出日時 | 2014-11-13 23:26:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 1,073 bytes |
| コンパイル時間 | 746 ms |
| コンパイル使用メモリ | 86,320 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 10:16:49 |
| 合計ジャッジ時間 | 1,357 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
double calc(int x, int y) {
return (double)x * x / (x * x + y * y);
}
int main() {
int K; cin >> K;
int n = 1 << K;
vector<int> R(n);
for (int i = 0; i < n; i++) cin >> R[i];
vector< vector<double> > dp(K + 1);
dp[0].assign(n, 1);
for (int k = 1; k <= K; k++) {
dp[k].assign(n, 0);
int m = 1 << (k - 1);
for (int i = 0; i < n; i++)
for (int j = m * ((i / m) ^ 1); j < m * ((i / m) ^ 1) + m; j++)
dp[k][i] += dp[k - 1][i] * dp[k - 1][j] * calc(R[i], R[j]);
}
printf("%.10f\n", dp[K][0]);
}
sugim48