QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 256 MB 總分: 100

#12580. 神奇的 GCD

统计

一个非空正整数序列的 Magical GCD 定义为该序列的长度与其所有元素的最大公约数的乘积。

给定一个序列 $(a_1, \dots, a_n)$,求其连续子序列中最大的 Magical GCD

输入格式

输入的第一行包含测试用例的数量 $T$。接下来是各测试用例的描述:

每个测试用例的描述以一行包含单个整数 $n$ 开始,其中 $1 \leqslant n \leqslant 100\,000$。下一行包含序列 $a_1, a_2, \dots, a_n$,其中 $1 \leqslant a_i \leqslant 10^{12}$。

输出格式

对于每个测试用例,输出一行,包含一个整数:输入序列的连续子序列中最大的 Magical GCD

样例

样例输入 1

1
5
30 60 20 20 20

样例输出 1

80

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.