刚开始没有用pow算连乘,而是直接用for循环,这样导致最后一个测试点超时;换成pow之后就都AC啦
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>
const int maxn = 100010;
int n;// the total number of the members in the supply chain
double p;//the unit price given by the root supplier
double r;//the percentage rate of price increment
using namespace std;
struct node{
double data;//存放当前叶结点的盈利
vector<int> child;
int leaf;// 是否为叶节点 0代表非叶结点 叶节点存储货量
int level;//层数
}Node[maxn];
void init() {
for(int i = 0; i < n; i++){
if