#include <iostream> #include <string> #include <vector> #include <algorithm> #include <stack> #include <map> #include <queue> #include <cmath> using namespace std; int arr[100000]; //数组开大点,不然会栈溢出或者越界 int gcd(int a, int b) { if (a == 0) { return b; } if (b == 0) { return a; } return gcd(b, a % b); } int main() { int n; while (scanf("%d", &n) != EOF) { // 注意 while 处理多个 case int maxnum, minnum; //最大值,最小值 for (int i = 0; i < n; i++) { if (i == 0) { scanf("%d", &arr[i]); maxnum = arr[i]; minnum = arr[i]; } else { scanf("%d", &arr[i]); maxnum = maxnum > arr[i] ? maxnum : arr[i]; minnum = minnum < arr[i] ? minnum : arr[i]; } } int t = gcd(maxnum, minnum); printf("%d %d %d\n", minnum, maxnum, t); } } // 64 位输出请用 printf("%lld")