HBC209430InfiniteTree题解 (letmindiv(n))

淫家是湿人 算法基础篇 33 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Let mindivmathrm{mindiv}mindiv be the minimum divisor greater than 1 of n. Bobo construsts a tree on all positive integer numbers {1,2,…,} by adding edges between n and nmindivfrac{n}{mathrm{mindiv}}mindivn for all n > 1. Let δ(u,v)deltaδ(u,v) be the number of edges between vertices u and v on the tree. Given m and w1,…,wm, Bobo would like to find minu∑i=1mwiδ(u,i!

Let mindiv(n)mathrm{mindiv}(n)mindiv(n) be the minimum divisor greater than 1 of n. Bobo construsts a tree on all positive integer numbers {1,2,…,}{1, 2, dots, }{1,2,…,} by adding edges between n and nmindiv(n)frac{n}{mathrm{mindiv}(n)}mindiv(n)n​ for all n > 1. Let δ(u,v)delta(u, v)δ(u,v) be the number of edges between vertices u and v on the tree. Given m and w1,…,wmw_1, dots, w_mw1​,…,wm​, Bobo would like to find min⁡u∑i=1mwiδ(u,i!)min_{u} sum_{i = 1}^{m} w_i delta(u, i!)minu​∑i=1m​wi​δ(u,i!).

HBC209430InfiniteTree题解
(letmindiv(n))-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC209430InfiniteTree题解