😊 | Powered By HeartFireY |
Problem Analysis
根据二叉树本身性质以及题目给出的条件限制,我们发现整棵树倾向于三角形的组合。那么我们不妨设第二层两个节点间的距离为,那么我们不难发现,第层的宽度为,那么我们可以求出与层之间的面积:。
#include <bits/stdc++.h>
using namespace std;
signed main(){
int t; cin >> t;
while (t--){
int n; cin >> n;
double x, y, xl, yl, xr, yr; cin >> x >> y >> xl >> yl >> xr >> yr;
double h = abs(yl - y), a = xr - xl;
double ans = a * h / 2 * (4 * (n - 2) + 3 * pow(0.5, n - 2) - 2);
printf("%.3lf\n", ans);
}
return 0;
}