Cod sursa(job #3198835)
Utilizator | Data | 30 ianuarie 2024 18:12:23 | |
---|---|---|---|
Problema | Indep | Scor | 20 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in ("indep.in");
ofstream out ("indep.out");
#define Dumnezeu
const int LIM=1001;
int n,x;
int dp[LIM];
int main()
{
in>>n;
for(int i=1; i<=n; i++)
{
in>>x;
for(int j=1; j<LIM; j++)
{
dp[__gcd(x,j)]+=dp[j];
}
dp[x]++;
}
out<<dp[1];
return 0;
}