Pagini recente » Cod sursa (job #2026933) | Cod sursa (job #411726) | Cod sursa (job #1667758) | Cod sursa (job #1093995) | Cod sursa (job #549000)
Cod sursa(job #549000)
var n:longint;
j,i,q,k,nr:longint;
f1,f2:text;
a:array[0..1500000000]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.