Cod sursa(job #122281)
Utilizator | Data | 11 ianuarie 2008 18:09:47 | |
---|---|---|---|
Problema | Multiplu | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
var a,b,m,c,i,x,p:longint;
ok:boolean;
h,g:text;
begin
assign(h,'multiplu.in');
reset(h);
assign(g,'multiplu.out');
rewrite(g);
read(h,a,b);
i:=1;p:=a;
repeat
a:=p;
i:=i+1;
a:=a*i;
c:=a;
while c>0 do begin
x:=c mod 10;
if (x=0)or(x=1) then begin c:=c div 10; ok:=true; end
else begin c:=0; ok:=false; end;
end;
if ok=true then
if a mod b=0 then m:=a;
until (a mod b=0)and(ok=true);
write(g,m);
close(h);
close(g);
end.