Cod sursa(job #541424)
Utilizator | Data | 25 februarie 2011 11:00:01 | |
---|---|---|---|
Problema | Light2 | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Romanian Master in Mathematics and Sciences 2011, Ziua 1 | Marime | 0.39 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream aa("light2.in");
ofstream ss("light2.out");
long long n,i,k,x[22],sum,j;
bool y[100000001];
int main() {
aa >> n >> k;
for(i=1;i<=k;++i) {
aa >> x[i];
for(j=x[i];j<=n;j+=x[i]) {
if (!y[j]) {
y[j]=true;
++sum;
}
else {
y[j]=false;
--sum;
}
}
}
ss << sum;
return 0;
}