Pagini recente » Cod sursa (job #2304286) | Cod sursa (job #1930382) | Cod sursa (job #2437706) | Cod sursa (job #2512435) | Cod sursa (job #603488)
Cod sursa(job #603488)
program pascal;
var
cifra1,cifra2:array[0..100] of integer;
r,i,j,x:longint;
d:byte;
count:integer;
f,g:text;
begin
assign(f,'pascal.in');
assign(g,'pascal.out');
reset(f);
read(f,r);
read(f,d);
close(f);
cifra1[1]:=1;
x:=1;
if r<>0 then
repeat
x:=x+1;
for i:=1 to x do
cifra2[i]:=cifra1[i]+cifra1[i-1];
for i:=1 to x do
cifra1[i]:=cifra2[i];
until x=r+1;
rewrite(g);
for i:=1 to x do
begin
if cifra1[i]<>0 then
if cifra1[i] mod d=0 then
count:=count+1;
end;
write(g,count);
close(g);
end.