#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#define ll long long
using namespace std;
int nm[100005];
vector<int>tree[100005];
double ans,m,inc;
void dfs(int u,double pri)
{
if(tree[u].size() == 0)
{
ans+=pri*nm[u];
return;
}
for(int i = 0;i<tree[u].size();i++)dfs(tree[u][i],pri*(1.0+inc/100));
}
int main()
{
int n,i,j,k,x;
while(scanf("%d%lf%lf",&n,&m,&inc)!=EOF)
{
ans = 0;
for(i = 0;i<n;i++)
{
scanf("%d",&k);
if(k == 0)scanf("%d",&nm[i]);
else
{
for(j = 0;j<k;j++)
{
scanf("%d",&x);
tree[i].push_back(x);
}
}
}
dfs(0,m);
printf("%.1lf\n",ans);
}
return 0;
}
pat1079 Total Sales of Supply Chain
最新推荐文章于 2022-10-06 17:39:32 发布