CodeForces1109D Sasha and Interesting Fact from Graph Theory(扩展Cayley公式)
传送门.题目翻译:给出n,m,a,b要求生成一棵有标号有边权的n个点的树,边权∈[1…m]是a->b的距离=m问方案数,对1e9+7取模。n,m#definelllonglong#definefo(i,x,y)for(inti=x;i=y;i--)usingnamespacestd;constintmo=1e9+7;llksm(llx,lly){lls=1;if(y<0)x=ksm(x,mo-2)