Cod sursa(job #302205)

Utilizator theocmtAxenie Theodor theocmt Data 8 aprilie 2009 19:02:54
Problema Cifre Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.46 kb
var a,b,c,k,i,ii,q,n:longint;
    f,g:text;
    nr:real;
begin
assign(f,'cifre.in');
assign(g,'cifre.out');
reset(f); rewrite(g);
read(f,a,b,c,k);
for i:=a to b do
    begin
         ii:=i;
         q:=0;
         while ii<>0 do
               begin
                    if ii mod 10=c then inc(q);
                    ii:=ii div 10;
               end;
         if q>=k then inc(n);
    end;
nr:=b;
write(g,n/nr:25:4);
close(f);
close(g);
end.