C - Monsters Battle Royale

C - Monsters Battle Royale。
ユークリッドの互除法を応用する問題。

from fractions import gcd


def solve():

    N = int(input())
    A = [int(i) for i in input().split()]
    a = A[0]
    for i in range(1, N):
        # 先頭をとって、gcdを繰り返していく
        a = gcd(a, A[i])
    print(a)


if __name__ == "__main__":  
    solve()

細かい理論はまだ良くわかっていないが、下記サイトが参考になる * http://9871225.blog.fc2.com/blog-entry-241.html

ユークリッドの互除法をそろそろしっかり理解したほうが良い