Pagini recente » Cod sursa (job #2787461) | Cod sursa (job #790139) | Cod sursa (job #1922009) | Cod sursa (job #2346133) | Cod sursa (job #112456)
Cod sursa(job #112456)
var a,b,c,i,j,l,w,k,t:longint;
f,g:text;
begin
assign(f,'cifre.in');
reset(f);
read(f,a);
read(f,b);
read(f,c);
read(f,k);
close(f);
w:=0;
l:=0;
if k<3 then
for i:=a to b do begin
inc(l);
j:=i;
t:=0;
repeat
if j mod 10=c then inc(t);
j:=j div 10;
until j<=0;
if t>=k then inc(w);
end
else w:=1;
assign(g,'cifre.out');
rewrite(g);
write(g,w/l:10:4);
close(g);
end.