题目
Code
#include
#include
#include
#include
using namespace std;
const int maxn=100100;
struct node{
double data;
vector child;
}Node[maxn];
int n;
double p,r,ans=0;
void DFS(int index,int depth){
if(Node[index].child.size()==0){// leaf 临界条件
ans+=Node[index].data*pow(1+r, depth);
return;
}
for(int i= 0; i<Node[in