Pagini recente » Cod sursa (job #2373021) | Cod sursa (job #999578) | Cod sursa (job #2062659) | Cod sursa (job #1795213) | Cod sursa (job #47209)
Cod sursa(job #47209)
var f,g:text;
a,b,c,k,x,y,i,pos,fav:longint;
begin
assign(f,'cifre.in');
reset(f);
readln(f,a,b,c,k);
close(f);
assign(g,'cifre.out');
rewrite(g);
pos:=b-a+1;
fav:=0;
p:=1;
for i:=2 to k do
p:=p*10+1;
if p>a then a:=p;
for i:=a to b do
begin
x:=0;
y:=i;
while y<>0 do
begin
if y mod 10=c then inc(x);
y:=y div 10;
end;
if x>=k then inc(fav);
end;
writeln(g,fav/pos:12:4);
close(g);
end.