#include<bits/stdc++.h> using namespace std; struct node{ int now; double p; node(int a,double b):now(a),p(b){} }; const double eps = 1e-4; vector<int>g[100010]; int main(){ int n; double pri,r; cin>>n>>pri>>r; for(int i=0;i<n;i++){ int k; cin>>k; while(k--){ int t; cin>>t; g[i].push_back(t); } } double low = 1e7; int cnt=0; queue<node>q; q.push(node(0,pri)); while(!q.empty()) { node p = q.front(); q.pop(); if(g[p.now].size()==0){ if(p.p<low){ low = p.p; cnt=1; } else if(fabs(p.p-low)<eps)cnt++; } for(int i=0;i<g[p.now].size();i++) { q.push(node(g[p.now][i],p.p+p.p*r/100)); } } printf("%.4f %d\n",low,cnt); return 0; }
广搜找最短路。。。嗯。。。
注意判断精度 既然保留4位小数不仿eps就设置成1e-4