Pagini recente » Cod sursa (job #194103) | Cod sursa (job #3195634) | Cod sursa (job #695630) | Cod sursa (job #768770) | Cod sursa (job #548999)
Cod sursa(job #548999)
var n:longint;
j,i,q,k,nr:longint;
f1,f2:text;
a:array[0..2100000000]of boolean;
begin
assign(f1,'light2.in');
reset(f1);
assign(f2,'light2.out');
rewrite(f2);
readln(f1,n);
readln(f1,k);
for i:=1 to k do
begin
read(f1,q);
j:=0;
while j+q<=n do
begin
inc(j,q);
if a[j] then a[j]:=false else a[j]:=true;
end;
end;
nr:=0;
for i:=1 to n do
if a[i] then inc(nr);
writeln(f2,nr);
close(f1);
close(f2);
end.