Algorithm for finding the greatest common divisor of N (1~20) integers (1~200000)

Yancheng Normal University Software Association ACM/ICPC Questions

Please retain the relevant author comments and indicate the source if you need to reprint

Explanation:

The algorithm uses optimization of bitwise operations to reduce the cost of MOD and division operations

The result is obtained in one traversal

The algorithm has a time complexity of O(n) and a worst-case complexity of O(Log2^C *N), where C is the largest number among all the numbers

/**/