Cod sursa(job #338931)
Utilizator | Data | 7 august 2009 15:35:20 | |
---|---|---|---|
Problema | Cifre | Scor | 40 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.7 kb |
var a,b,i,n,ct,ct1:longint;
k,uc,c:byte;
t:real;
f1,f2:text;
begin
assign(f1,'cifre.in');
reset(f1);
assign(f2,'cifre.out');
rewrite(f2);
read(f1,a,b,c,k);
ct1:=0;
for i:=a to b do
begin
ct:=0;
n:=i;
while n<>0 do
begin
uc:=n mod 10;
n:=n div 10;
if uc=c then inc(ct);
if ct=k then begin
inc(ct1);break;end;
end;
end;
t:=ct1/(b-a+1);
write(f2,t:8:4);
close(f1);
close(f2);
end.