poj 1789 Truck History

 where the sum goes over all pairs of types in the derivation plan such that to is the original type and td the type derived from it and d(to,td) is the distance of the types

1/Σ(to,td)d(to,td)


派生關係有向邊,邊權爲兩個串的不同字符的個數,要求的是找出一種用到所有串的派生關係,使得Q最小,(因爲是1/Q),所以這題就是求最小生成樹

 

最樸素的最小生成樹AC

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章