eolymp
bolt
Try our new interface for solving problems
Problems

Maximum GCD

Maximum GCD

Given $n$ integers. You have to find the maximum GCD (greatest common divisor) of every possible pair of these integers. \InputFile The first line contains the number of test cases $t\:(1 \le t \le 100)$. The following $t$ lines are the $t$ test cases. Each test case contains $n\:(1 \le n \le 100)$ positive integers. \OutputFile For each test case, print on a separate line the maximum GCD value among all possible pairs of integers. \Note For the first test case, the answer is GCD(20, 40) = 20. For the third test case, the answer is GCD(125, 25) = 25.
Time limit 1 second
Memory limit 128 MiB
Input example #1
3
10 20 30 40
7 5 12
125 15 25
Output example #1
20
1
25
Source ACM-ICPC Thailand National Programming Contest 2010, Prince of Songkla University Phuket Campus 24 August 2010