#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include//assert(); //#include //xAOJ ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)< ///////// typedef long long LL; typedef long double LD; typedef unsigned long long ULL; ///////// using namespace::std; ///////// ///////// void solve(){ int N,M; cin >> N >> M; vector< vector > G(N,vector(N,0)); vector< vector > use(N,vector(N,false) ); vector< int > line(N,0); vector< bool > post(N,false); int A,B,C; for(int i=0;i> A >> B >> C; G[A][B] = C; ++line[B]; } vector ret(N,0.0); ret[0] = 1.0; queue q; q.push(0); int id; while( !q.empty() ){ id = q.front(); q.pop(); //配る番 if( post[id] ) continue; if( line[id] ){ q.push( id ); continue; } post[id] = true; for(int i=0;i