ABC 357 (D ~ F)
D
https://www.luogu.com.cn/problem/AT_abc357_d
Solution
hint1
考虑把这个式子拆开。hint2
拆成了这个形式:$n \times 10^{(n - 1)c} + \cdots + n$。直接等比数列求和即可。E
https://www.luogu.com.cn/problem/AT_abc357_e
Solution
hint1
先考虑如果是一颗数怎么做。hint2
基环树直接把那个环缩成一个点即可。然后就是一颗内向树了,类似 topsort 算一下就行。
F
https://www.luogu.com.cn/problem/AT_abc357_f
Solution
hint1
考虑把新增的贡献拆开。hint2
那就是:$ans'(l, r) = ans(l, r) + x\times b(l, r), a'(l, r) = a(l ,r) + (r - l + 1) \times x$。 对 $b$ 同理。然后这个 \(ans\) 在修改 \(a,b\) 的时候直接维护即可,只需要对 \(a,b\) 打标记。

浙公网安备 33010602011771号