Logo
(追記) (追記ここまで)

25666번 - Just Another Number Theory Problem 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB30181657.143%

문제

Given are $n$ prime numbers 1ドル < p_1 < p_2 < \ldots < p_n < 10^{18}$ with $p_1 \le 100$. We say that the number $x$ is good if $x$ is divisible by at least one $p_i$.

Take all good numbers $a_1, a_2, \cdots, a_m$ in $[0, p_1 \cdot p_2 \cdot \ldots \cdot p_n]$ and sort them in order ($a_1 < a_2 < \ldots < a_m$). Your task is to calculate $\sum_{i=1}^{m-1} (a_{i+1} - a_i)^2$. As the sum could be very large, you should output it modulo 998ドル,244円,353円$.

입력

The first line of the input contains a single integer $n$ (1ドル \le n \le 10^5$).

The next line of the input contains $n$ integers $p_1, p_2, \ldots, p_n$ (1ドル < p_1 < p_2 < \ldots < p_n < 10^{18}$). It is guaranteed that 2ドル \le p_1 < 100$ and each $p_i$ (1ドル \le i \le n$) is a prime number.

출력

Output a single line with a single integer, indicating the answer modulo 998ドル,244円,353円$.

제한

예제 입력 1

2
2 5

예제 출력 1

18

예제 입력 2

3
5 7 233

예제 출력 2

31275

노트

In the first example, the list of good numbers is:

  • $a_1 = 0$
  • $a_2 = 2$
  • $a_3 = 4$
  • $a_4 = 5$
  • $a_5 = 6$
  • $a_6 = 8$
  • $a_7 = 10$

Thus, the answer is $(2-0)^2+(4-2)^2+(5-4)^2+(6-5)^2+(8-6)^2+(10-8)^2=18$.

출처

Camp > Petrozavodsk Programming Camp > Summer 2022 > Day 3: Qingyu, flower and their friends’ Contest J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /