Pagini recente » Cod sursa (job #1337241) | Cod sursa (job #331832) | Cod sursa (job #2611952) | Cod sursa (job #1269424) | Cod sursa (job #1610941)
var A,B,C,K,N,jos,sus,o,u,copya,copyb:longint;
BEGIN
assign(input,'cifre.in'); reset(input);
assign(output,'cifre.out'); rewrite(output);
readln(input,A,B,C,K);
n:=0;
o:=0;
u:=0;
copya:=a; copyb:=b;
while A<B do
begin
jos:=A; sus:=B;
while (jos>0) or (sus>0) do
begin
if (jos>0) and (jos mod 10 = c) then inc(o);
jos:=jos div 10;
if (sus>0) and (sus mod 10 = c) then inc(u);
sus:=sus div 10;
end;
if o>=k then inc(n);
if u>=k then inc(n);
o:=0; u:=0;
inc(a);
dec(b);
end;
write(output,N/((copyb-copya)+1):0:4);
close(input);
close(output);
END.