Cod sursa(job #3218378)

Utilizator Robert_MitriRobert Mitri Robert_Mitri Data 27 martie 2024 08:50:19
Problema Indep Scor 20
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("indep.in");
ofstream fout("indep.out");

const int nmax = 500;

int d[1005];

int n;


int main()
{
    fin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        fin>>x;
        for(int j = 1; j<=1000;j++)
            if(d[j] != 0)
                d[__gcd(j,x)] += d[j];
        d[x]++;
    }
    fout<<d[1];
}