cin >> x >> y >> z; int t = max(z, max(x, y)); for (int i = t; i >= 1; i--) { if ((x % i) == (y % i) && (y % i) == (z % i) && (x % i) == 0) { cout << i; return 0; } }
把所有情况都列举了一遍。