145. GCD of an Array
EasyGCD
Print the greatest common divisor of all numbers.
Input format
Line 1: n Line 2: n positive integers
Output format
The GCD.
Example 1
Input
3 12 18 24
Output
6
Example 2
Input
2 7 13
Output
1
Constraints
1 ≤ n ≤ 10⁵ 1 ≤ values ≤ 10¹⁸
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…