Cod sursa(job #738533)

Utilizator paul777Astalas Paul paul777 Data 20 aprilie 2012 19:18:18
Problema Zero 2 Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.39 kb
var f,g:text;n,b,k,j,c,m,d:longint;i:integer;
begin assign(f,'zero2.in');reset(f);assign(g,'zero2.out');rewrite(g);
for i:=1 to 10 do begin read(f,n,b);k:=1;
for j:=1 to n do k:=k*j;
repeat m:=m*10+k mod b;k:=k div b;until k div b=0;k:=0;
repeat d:=d*10+m mod 10;m:=m div 10;until m div 10=0;c:=0;
while d mod 10=0 do begin c:=c+1;d:=d div 10;end;writeln(g,c);end;
close(f);close(g);end.