#P11014. 「ALFR Round 4」D 罪人的终幕

    ID: 12280 远端评测题 500ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数论Special JudgeO2优化李超线段树

「ALFR Round 4」D 罪人的终幕

Background

And I promise you, everything will end in a grand, theatrical trial...
Spin a little, jump lightly, and then comes the curtain call of the "sinner".

Problem Description

Define a function a(x)a(x) as the sum of distinct prime factors of the natural number xx.

If x=piPpidix=\prod\limits_{p_i\in\mathbb{P}}p_i^{d_i}, then $a(x)=\sum\limits_{p_i\in \mathbb{P}}p_i\times[d_i\ge1]$, where P\mathbb{P} is the set of primes, and a(1)=0a(1)=0.

Starting from the first day of her birth, Furina has had an expectation value m1m_1.

Before the final trial arrives, every day she chooses to sort out her feelings. The method is as follows:

Suppose today is day ii. Furina sets today's expectation value mim_i to $\max\{\dfrac{m_j}{a(\operatorname{lcm}(w_i,w_j))+a(\gcd(w_i,w_j))}+k\}$, where 2in2\le i\le n, 1j<i1\le j<i, and kk is the expectation value gained from watching the trial.

Please compute i=1nmi\sum\limits_{i=1}^n m_i.

Input Format

The first line contains three integers n,m1,kn,m_1,k, representing the number of days until the final trial (including the first day), the expectation value on the first day, and the expectation value gained from watching the trial.

The second line contains nn integers representing w1,w2,w3,,wnw_1,w_2,w_3,\cdots,w_n.

Output Format

Output one real number in one line representing i=1nmi\sum\limits_{i=1}^n m_i. Your answer is considered correct if the absolute error compared with the correct answer does not exceed 10610^{-6}.

4 4 7
7 10 16 8
28.047619

Hint

Sample Explanation

The expectation values for these 44 days are 4,7.285714,7.809524,8.9523814,7.285714,7.809524,8.952381.

Constraints

Subtask Points Limits
00 3030 n,m1,k103n,m_1,k\le10^3wi29w_i\le29
11 7070 -

For 100%100\% of the testdata, 1n1823761\le n\le182376, 1m11071\le m_1\le10^7, 0k1060\le k\le10^6, 2wi1823762\le w_i\le182376.

The testdata for this problem may be a bit weak. You are welcome to provide hacks for incorrect solutions.

Translated by ChatGPT 5