logo AlgoBeat OnlineJudge
登录 注册

#206167. [CERC2013] Magical GCD

内存限制:1024 MiB 时间限制:8000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

The Magical GCD of a nonempty sequence of positive integers is defined as the product of its length and the greatest common divisor of all its elements.

Given a sequence , find the largest possible Magical GCD of its connected subsequences.

输入格式

The first line of input contains the number of test cases . The descriptions of the test cases follow:

The description of each test case starts with a line containing a single integer , . The next line contains the sequence , .

输出格式

For each test case output one line containing a single integer: the largest Magical GCD of a connected subsequence of the input sequence.

样例

样例输入 1

1
5
30 60 20 20 20

样例输出 1

80

数据范围与提示

Time limit: 8000 ms, Memory limit: 1048576 kB.

Central Europe Regional Contest (CERC) 2013