Cod sursa(job #47197)

Utilizator cheery_g1rlHaller Emanuela cheery_g1rl Data 3 aprilie 2007 13:58:34
Problema Cifre Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.42 kb
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;
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.