Cod sursa(job #541498)
Utilizator | Data | 25 februarie 2011 11:46:24 | |
---|---|---|---|
Problema | Light2 | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Romanian Master in Mathematics and Sciences 2011, Ziua 1 | Marime | 0.42 kb |
#include<iostream>
#include<fstream>
using namespace std;
long long x[90000000];
int main()
{
ifstream f("light2.in");
ofstream g("light2.out");
long long n,i,a,aprinse=0,k,ca;
f>>n;
f>>k;
for( i=1;i<=k;i++)
{
f>>a;
ca=a;
while(a<=n)
{
if(x[a]==0)
{
x[a]=1;
aprinse++;
}
else
{
x[a]=0;
aprinse--;
}
a=a+ca;
}
}
g<<aprinse;
}