Codeforces Global Round 24
B
Doremy's Perfect Math Class
Codeforces
900
原题
← AC →
翻译中…

"Everybody! Doremy's Perfect Math Class is about to start! Come and do your best if you want to have as much IQ as me!" In today's math class, Doremy is teaching everyone subtraction. Now she gives you a quiz to prove that you are paying attention in class.

翻译中…

You are given a set $S$ containing positive integers. You may perform the following operation some (possibly zero) number of times:

翻译中…
  • choose two integers $x$ and $y$ from the set $S$ such that $x \gt y$ and $x - y$ is not in the set $S$.
  • add $x-y$ into the set $S$.
翻译中…

You need to tell Doremy the maximum possible number of integers in $S$ if the operations are performed optimally. It can be proven that this number is finite.

翻译中…

Input

翻译中…

The input consists of multiple test cases. The first line contains a single integer $t$ ($1\le t\le 10^4$) — the number of test cases. The description of the test cases follows.

翻译中…

The first line contains an integer $n$ ($2 \le n\le 10^5$) — the size of the set $S$.

翻译中…

The second line contains $n$ integers $a_1,a_2,\dots,a_n$ ($1\le a_1 \lt a_2 \lt \cdots \lt a_n \le 10^9$) — the positive integers in $S$.

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

翻译中…

Output

翻译中…

For each test case, you need to output the maximum possible number of integers in $S$. It can be proven that this value is finite.

翻译中…

Note

翻译中…

In the first test case, no such $x$ and $y$ exist. The maximum possible number of integers in $S$ is $2$.

翻译中…

In the second test case,

翻译中…
  • $S=\{5,10,25\}$ at first. You can choose $x=25$, $y=10$, then add $x-y=15$ to the set.
  • $S=\{5,10,15,25\}$ now. You can choose $x=25$, $y=5$, then add $x-y=20$ to the set.
  • $S=\{5,10,15,20,25\}$ now. You can not perform any operation now.
翻译中…

After performing all operations, the number of integers in $S$ is $5$. It can be proven that no other sequence of operations allows $S$ to contain more than $5$ integers.

翻译中…

样例

Input #1
2
2
1 2
3
5 10 25
Output #1
2
5
InputCopy OutputCopy
题目信息
题号
1764B
时间限制
1 s
内存限制
256 MB
标签
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。