Cod sursa(job #2648488)

Utilizator OvidRata Ovidiu Ovid Data 11 septembrie 2020 10:50:38
Problema Indep Scor 25
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.73 kb
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll


ifstream fin("indep.in"); ofstream fout("indep.out");
#define cin fin
#define cout fout


int t, n, m, k, a[501], q, l, r;
int cnt[501][1001];


int32_t main(){
INIT
cin>>n;cnt[0][0]=1;
for(int i=1; i<=n; i++){cin>>a[i]; for(int j=0; j<=1000; j++){cnt[i][j]+=cnt[i-1][j];cnt[i][__gcd(a[i], j)]+=cnt[i-1][j];}    }
cout<<cnt[n][1];

return 0;
}