可以将式子的求值用矩阵乘法表示:当前的表达式形如 $A+B\cdot C$,可以用矩阵表示 $A,B\cdot C,B,1$ 之间的转移。对于所有情况求和只需将每个位置的矩阵求和之后乘起来即可。时间复杂度 $O(n)$。
QOJ.ac
QOJ
Discussion #1053 for Problem #17154. Evaluation
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2026-02-19 13:12:21
Last updated: 2026-02-19 13:12:26
题解
Comments
No comments yet.