CF402D Upgrading Array

题目描述

给一个有n个数 a[1],a[2],…,a[n] 的数列打分,你认为 b[1],b[2]…,b[m] 是不好的质数。定义这个序列的分值为各个数的分值之和,设 x 的分值为 f(x),f(x)=f(x/p)+k (p 为 x 的最小质因子;若 p 为不好的质数, k 取 −1 ,否则 k 取 +1 ; f(1)=0 )。 你想让序列的分值更大,可以反复进行一项操作:$a[1],a[2],a[3],...,a[i](i

输入格式

输出格式

说明/提示

Note that the answer to the problem can be negative. The GCD( $ x_{1} $ , $ x_{2} $ , ..., $ x_{k} $ ) is the maximum positive integer that divides each $ x_{i} $ .