Cod sursa(job #2731156)
| Utilizator | Data | 27 martie 2021 13:35:51 | |
|---|---|---|---|
| Problema | Pairs | Scor | 20 |
| Compilator | cpp-64 | Status | done |
| Runda | simulare_oni_cex | Marime | 0.52 kb |
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5+5;
int w[NMAX];
long long sol = 0;
int main()
{
ifstream fin("pairs.in");
ofstream fout("pairs.out");
int n, i;
fin >> n;
for(i = 1; i <= n; ++i)
fin >> w[i];
int j;
for(i = 1; i < n; ++i){
for(j = i + 1; j <= n; ++j){
if(w[i] == w[j])
continue;
if(__gcd(w[i], w[j]) == 1)
++sol;
}
}
fout << sol;
return 0;
}
