Problem J. Prime Game (贡献思想)

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]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值