Cod sursa(job #2304325)

Utilizator frodobiosif aug frodob Data 17 decembrie 2018 21:45:51
Problema Pairs Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
#include <algorithm>

using namespace std;

//int gcd(int a, int b);

int main() {
  fstream fin("pairs.in", ios::in);
  fstream fout("pairs.out", ios::out);
  // citesc N
  int N;
  fin>>N;
  // aloc si citest sirul de numere
  int* elements = new int[N];
  for(int i = 0; i<N; i++)
    fin>>elements[i];
  long long count = 0;
  for (int i = 0; i<N-1; i++)
    for (int j = i+1; j<N; j++)
      if (1==__gcd(elements[i], elements[j]))
        count++;
  fout<<N;
  // the end
  fin.close();
  fout.close();
  delete[] elements;
  return 0;
}