输出最小价格和能提供最低价格的叶子结点的个数
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
const int maxn = 111110;
vector<int>node[maxn];
int num = 0;
int minLevel = 100010;
void dfs(int index, int level)
{
if (node[index].size() == 0)
{
if (level < minLevel)
{
minLevel = level;
num=1;
}
else if(level == minLevel)
{
num++;
}
return;
}
for (int i = 0; i < node[index].size(); i++)
{
dfs(node[index][i], level + 1);
}
}
int main()
{
int n; double p, s;
int k, child;
cin >> n >> p >> s;
s /= 100;
for (int i = 0; i < n; i++)
{
cin >> k;
for (int j = 0; j < k; j++)
{
cin >> child;
node[i].push_back(child);
}
}
dfs(0, 0);
double ans = p*pow(1 + s, minLevel);
printf("%.4f %d", ans, num);
}