1106 Lowest Price in Supply Chain (25 分)
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
vector<int> v[100100];
int minh = 99999999, ret = 0;
void dfs(int x, int h){
if(v[x].size() == 0){
if(h < minh){
minh = h;
ret = 1;
}
else if(h == minh)
ret++;
}
for(int i = 0; i < v[x].size(); ++i)
dfs(v[x][i], h + 1);
}
int main(){
int n, k, x;
double p, r;
cin >> n >> p >> r;
for(int i = 0; i < n; ++i){
cin >> k;
while(k--){
cin >> x;
v[i].push_back(x);
}
}
dfs(0, 0);
printf("%.4lf %d", pow(1 + r / 100.0, minh) * p, ret);
}