CF1061C.Multiplicity

普及+/提高

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an integer array a1,a2,…,ana_1, a_2, \ldots, a_n.

The array bb is called to be a subsequence of aa if it is possible to remove some elements from aa to get bb.

Array b1,b2,…,bkb_1, b_2, \ldots, b_k is called to be good if it is not empty and for every ii (1≤i≤k1 \le i \le k) bib_i is divisible by ii.

Find the number of good subsequences in aa modulo 109+710^9 + 7.

Two subsequences are considered different if index sets of numbers included in them are different. That is, the values of the elements do not matter in the comparison of subsequences. In particular, the array aa has exactly 2n−12^n - 1 different subsequences (excluding an empty subsequence).

给你一个整数数组 a1,a2,…,ana_1, a_2, \ldots, a_n。

若可通过从 aa 中删除若干元素得到数组 bb,则称 bb 是 aa 的一个子序列。

若数组 b1,b2,…,bkb_1, b_2, \ldots, b_k 非空,且对每个 ii(1≤i≤k1 \le i \le k)均有 bib_i 被 ii 整除,则称其为“好”的子序列。

求 aa 中“好”子序列的个数,结果对 109+710^9 + 7 取模。

当两个子序列所包含元素的下标集合不同时,认为它们是不同的子序列。换言之,在比较子序列时,元素的值无关紧要。特别地,数组 aa 恰有 2n−12^n - 1 个不同的子序列(不包括空子序列)。

输入格式

The first line contains an integer nn (1≤n≤100 0001 \le n \le 100\,000) — the length of the array aa.

The next line contains integers a1,a2,…,ana_1, a_2, \ldots, a_n (1≤ai≤1061 \le a_i \le 10^6).

第一行包含一个整数 nn(1≤n≤100 0001 \le n \le 100\,000)—— 数组 aa 的长度。

第二行包含整数 a1,a2,…,ana_1, a_2, \ldots, a_n(1≤ai≤1061 \le a_i \le 10^6)。

输出格式

Print exactly one integer — the number of good subsequences taken modulo 109+710^9 + 7.

输出一个整数——即“好”子序列的数量对 109+710^9 + 7 取模的结果。

输入输出样例

  • 输入#1

    2
    1 2

    输出#1

    3
  • 输入#2

    5
    2 2 1 22 14

    输出#2

    13

说明/提示

In the first example, all three non-empty possible subsequences are good: 1{1}, 1,2{1, 2}, 2{2}

In the second example, the possible good subsequences are: 2{2}, 2,2{2, 2}, 2,22{2, 22}, 2,14{2, 14}, 2{2}, 2,22{2, 22}, 2,14{2, 14}, 1{1}, 1,22{1, 22}, 1,14{1, 14}, 22{22}, 22,14{22, 14}, 14{14}.

Note, that some subsequences are listed more than once, since they occur in the original array multiple times.

在第一个例子中,所有三个非空的可能子序列都是好的:1{1}、1,2{1, 2}、2{2}。

在第二个例子中,可能的好子序列有:2{2}、2,2{2, 2}、2,22{2, 22}、2,14{2, 14}、2{2}、2,22{2, 22}、2,14{2, 14}、1{1}、1,22{1, 22}、1,14{1, 14}、22{22}、22,14{22, 14}、14{14}。

注意,某些子序列被多次列出,因为它们在原数组中多次出现。

输入解题思路,AI测评打分。不知道怎么写?

首页