Editorial for Bedao Mini Contest 02 - DELGCD

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Code mẫu

#include <bits/stdc++.h>

using namespace std;

int main()
    freopen("DELGCD.INP", "r", stdin);
    freopen("DELGCD.OUT", "w", stdout);

    int n, g = 0, x;
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> x, g = __gcd(x, g);

    cout << ((g == 1) ? 0 : -1);
    return 0;


Please read the guidelines before commenting.

There are no comments at the moment.