結果

問題 No.66 輝け☆全国たこやき杯
ユーザー mukadenodaioumukadenodaiou
提出日時 2018-03-30 16:13:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,659 bytes
コンパイル時間 959 ms
コンパイル使用メモリ 102,716 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 07:13:25
合計ジャッジ時間 1,699 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
#define rep(i,n) for(int i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
ll ppow(ll x, ll n) {
	ll ans = 1;
	while (n > 0) {
		if ((n & 1) == 1)ans = ans + x;
		x = x * x;
		n >>= 1;
		ans %= mod;
	}
	return ans;
}
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll n;
double v[2000], dp[2000][11];
int main() {
	cin >> n;
	cout  <<(1<< n) << endl;
	rep(i, 1 << n)cin >> v[i];
	rep(i, 1 << n)dp[i][0] = pow(v[i / 2 * 2 + i % 2],2) / (pow(v[i / 2 * 2],2) + pow(v[i / 2 * 2 + 1],2));
	for (int j = 1; j < n; ++j) {//j:回戦
		rep(i, 1 << n) {//i:ひと
			int p;
			if (i % (1 << j + 1) < (1 << j)) {
				p = (i / (1 << j) + 1)*(1 << j);
				for (int k = p; k < p + (1 << j); ++k) {
					dp[i][j] += (dp[i][j - 1] * dp[k][j - 1] * pow(v[i], 2) / (pow(v[i], 2) + pow(v[k], 2)));
				}
			}
			else {
				p = p = (i / (1 << j) - 1)*(1 << j);
				for (int k = p; k < p + (1 << j); ++k) {
					dp[i][j] += (dp[i][j - 1] * dp[k][j - 1] * pow(v[i], 2) / (pow(v[i], 2) + pow(v[k], 2)));
				}
			}
		}
	}
	cout << dp[0][n-1] << endl;
	return 0;
}
0