#P14009. 「florr IO Round 1」数字游戏
「florr IO Round 1」数字游戏
Description
Given a positive integer and a sequence of positive integers , where represents the length of the sequence .
We define the weight of an interval as , where:
$$f(l, r) = \sum_{b_1=1}^{a_l} \sum_{b_2=1}^{a_{l+1}} \sum_{b_3=1}^{a_{l+2}} \dots \sum_{b_{r-l+1}=1}^{a_r} [\gcd(b_1, b_2, b_3, \dots, b_{r-l+1}) = 1]$$Find the sum of the weights of all intervals, that is, compute:
Output the answer modulo .
Input Format
The first line contains an integer .
The second line contains integers representing the sequence .
Output Format
Output a single line containing the answer.
2
1 2
4
5
2 4 4 5 4
1301
10
1 7 5 5 7 6 9 2 4 8
10816520
Hint
Data Range
This problem uses bundled tests.
| Subtask ID | Score | ||
|---|---|---|---|
| 1 | 5 | 10 | |
| 2 | 200 | 100 | 30 |
| 3 | 2000 | 1000 | |
| 4 | |||
Translated by ChatGPT 4.1
京公网安备 11011102002149号