fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. signed main() {
  6. //freopen("input.txt", "r", stdin);
  7. ios::sync_with_stdio(0);
  8. cin.tie(0);
  9. int n;
  10. cin >> n;
  11. int a[n];
  12. for(int i = 0; i < n; i++) {
  13. cin >> a[i];
  14. }
  15. sort(a, a + n, greater<int>());
  16. unique(a, a + n);
  17. cout << a[1] % a[0] << endl;
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1685382480