TopCoder

Caido
Waimai

User's AC Ratio

97.0% (131/135)

Submission's AC Ratio

70.8% (165/233)

Tags

Description

給你 N 個數字, 請求出他們的最大公因數。

例如 30,4266 的最大公因數是 6

因為 6 整除全部三個數。

Input Format

輸入有多組測資。

每組測資第一行有一個整數 N, 代表有幾個數字
接下來有 N 個正整數。

1N20
輸入的數字不會超過 1000000000

Output Format

請輸出 input 中 N 個數字的最大公因數。

Sample Input 1

3
30 42 66
4
30 42 70 105

Sample Output 1

6
1

Hints

Problem Source

原TIOJ1700 / kelvin

Subtasks

No. Testdata Range Score
1 0 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 262144 1