2434. Greatest Common Divisor

单点时限: 3.0 sec

内存限制: 256 MB

Your task is to find a greatest common divisor(GCD) from given integers.

输入格式

Input consists from multiple test cases.The first line of each test case contains single positive integer n (1 < n < 1024) which indicates the number of integers to find a GCD. Next line contains n positive integers separated by a single space. You have to calculate a GCD from these integers. A single line containing 0 denotes the end of input.

You can assume that input integers always fit in 32-bit signed integer.

输出格式

For each test case, you should output a GCD for each line.

样例

Input
2
4 10
0
Output
2

81 人解决,98 人已尝试。

96 份提交通过,共有 246 份提交。

3.3 EMB 奖励。

创建: 15 年,11 月前.

修改: 7 年,2 月前.

最后提交: 2 周,4 天前.

来源: ECNU 选拔 2008

题目标签