A1079-Total Sales of Supply Chain

也不难,DFS深度计算,乘一下就行

#include
using namespace std;
int N;
double p,r;
struct node
{
    double data;
    vector child;
}Node[100010];
double sum=0;

void DFS(int index,int depth)
{
    if(Node[index].child.size()==0)
    {
        sum+=Node[index].data*pow(1+r/100,depth)*p;
        return;
    }
    
    for(int i=0;i

你可能感兴趣的:(A1079-Total Sales of Supply Chain)