Cod sursa(job #541537)
| Utilizator | Data | 25 februarie 2011 11:59:01 | |
|---|---|---|---|
| Problema | Light2 | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Romanian Master in Mathematics and Sciences 2011, Ziua 1 | Marime | 0.63 kb |
// http://infoarena.ro/problema/light2
#include <fstream>
using namespace std;
#define maxSize 1000000
ifstream in("light2.in");
ofstream out("light2.out");
int length,kids,tmp;
int counter;
bool light[maxSize];
int main() {
in >> length;
in >> kids;
for(int i=1;i<=kids;i++) {
in >> tmp;
for(int k=tmp;k<=length;k+=tmp)
if(light[k]) {
light[k] = false;
counter--;
}
else {
light[k] = true;
counter++;
}
}
out << counter;
in.close();
out.close();
}
