Cod sursa(job #2705215)
| Utilizator | Data | 12 februarie 2021 10:25:36 | |
|---|---|---|---|
| Problema | Indep | Scor | 5 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("indep.in");
ofstream fout("indep.out");
ll n, el, pd[505][1005];
int main() {
fin >> n;
for (int i = 1; i <= n; ++i) {
fin >> el;
for (ll j = 1; j <= 1000; ++j) {
ll c = __gcd(el, j);
if (pd[i][c] == 0)
pd[i][c] = pd[i - 1][c];
pd[i][c] += pd[i - 1][j];
if (j != 1)
pd[i][j] += pd[i - 1][j];
}
++pd[i][el];
}
fout << pd[n][1];
return 0;
}
