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

19518번 - Math is Fun 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 256 MB186330.000%

문제

Boy XYZ introduced a simple math function called $\mathit{GLL}$ for an array of integers $S = \{a_1, a_2, \ldots, a_n\}$:

$$\mathit{GLL}(S) = \mathit{GCD}(S) \cdot \mathit{LCM}(S) \cdot \mathit{LCM}(S)\text{.}$$

Here, $\mathit{GCD}(S) = \mathit{GCD}(a_1, a_2, \ldots, a_n)$ is the greatest common divisor of integers $a_1, a_2, \ldots, a_n,ドル and $\mathit{LCM}(S) = \mathit{LCM}(a_1, a_2, \ldots, a_n)$ is the least common multiple of integers $a_1, a_2, \ldots, a_n$.

For an array consisting of one element, $\mathit{GCD}$ and $\mathit{LCM}$ are equal to that element. For example, $\mathit{GCD}$ of $S = \{x\}$ is $x$. Consider the $\mathit{LCM}$ and $\mathit{GCD}$ of an empty array as 0ドル$.

Now, XYZ is interested in finding the sum of $\mathit{GLL}$ values of all subarrays for a given array $A,ドル but he finds the problem very hard. Help him calculate the following:

$$\mathit{Answer} = \sum_{S \subseteq A}\mathit{GLL}(S)\text{.}$$

Here, $S \subseteq A$ means that $S$ is a subarray of $A,ドル that is, the array $A$ with some (possibly zero, possibly all) elements removed.

As the answer can be very large, print it modulo 10ドル^9 + 7$.

입력

The first line of input contains $T,ドル the number of test cases (1ドル \le T \le 50$). $T$ test cases follow.

The first line of each test case contains $N,ドル the number of elements in $A$ (1ドル \le N \le 100$). The next line contains $N$ space-separated positive integers: the elements of $A$. The numbers in the array are in the range $[1, 1000]$.

출력

For each test case, print the answer on a separate line.

제한

예제 입력 1

2
2
2 3
3
2 4 10

예제 출력 1

71
2904

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 8: DPRK Contest M번

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

출처

대학교 대회

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

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