Problem J. Prime Game
Input file: standard input
Output file: standard output
Given a suqence of n integers ai
.
Let mul(l, r) = ∏r
i=l
ai and fac(l, r) be the number of distinct prime factors of mul(l, r).
Please calculate ∑n
i=1
∑n
j=i
fac(i, j)
Input
The first line contains one integer n (1 ≤ n ≤ 106
) — the length of the sequence.
The second line contains n integers ai (1 ≤ i ≤ n, 1 ≤ ai ≤ 106
) — the sequence.
Output
Print the answer to the equation.
Examples
standard input standard output
10
99 62 10 47 53 9 83 33 15 24
248
10
6 7 5 5 4 9 9 1 8 12
134
弱鸡,看了大佬的模板敲得,大佬题解链接
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int M = 1e6 + 5;
int vis[M];
LL ans = 0;
vector<int> v[M]