Ohh that gcd again
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
Lets say \(gcd(Gi)\) means the gcd of a group or combination of any \(i\) elements of the array \(A[]\).
and \(∑gcd(Gi)\) means summation of the gcd of all possible groups of size \(i\).
find \((∑gcd(G1) * ∑gcd(G2) * ∑gcd(G3).....* ∑gcd(Gn))\)
\(gcd(e1,e2,e3...en)\) means the greatest common divisor among all elements \(e1,e2,e3...en\)
since the answer can be too large print it mod 1e9+7
Input
first line of input takes an integer \(T\) : number of testcases
first line of each testcase takes an integer \(N\) : size of the array A[]
second line of each testcase takes \(N\) integers A1,A2...An
\(1 <= T <= 100\)
\(1 <= N <= 10\)
\(1 <= Ai <= 1000\)
Output
for each testcase output 1 integer
Sample
Input | Output |
---|---|
|
|
in the 2nd testcase :
\(∑gcd(G1) = (2+2) = 4\)
\(∑gcd(G2) = gcd(2,2) = 2\)
\(ans = 4*2 = 8\)
in the 3rd testcase:
\(∑gcd(G1) = (2+3+4) = 9\)
\(∑gcd(G2) = {gcd(2,3)+gcd(2,4)+gcd(3,4)} = (1+2+1) = 4\)
\(∑gcd(G3) = gcd(2,3,4) = 1\)
\(ans = 9*4*1 = 36\)
LUCC Presents Kick & Code Intra LU Programming Contest
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 10
- Start at
- 2025-09-01 05:15
- End at
- 2025-09-01 07:45
- Duration
- 2.5 hour(s)
- Host
- Partic.
- 65