Pagini recente » Cod sursa (job #1396672) | Cod sursa (job #154896) | Cod sursa (job #535353) | Cod sursa (job #542109) | Cod sursa (job #548998)
Cod sursa(job #548998)
var n:longint;
j,i,q,k,nr:longint;
f1,f2:text;
a:array[0..20000000]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.