| 27 | }; |
| 28 | |
| 29 | static int64_t array_gcd(const auto& arr) |
| 30 | { |
| 31 | if (arr.empty()) |
| 32 | return 1; |
| 33 | |
| 34 | auto it = arr.begin(); |
| 35 | int64_t res = *it; |
| 36 | ++it; |
| 37 | |
| 38 | for (; it != arr.end(); ++it) |
| 39 | if ((res = std::gcd(*it, res)) == 1) |
| 40 | break; |
| 41 | |
| 42 | return res; |
| 43 | } |
| 44 | |
| 45 | int main(int argc, char* argv[]) |
| 46 | { |