Pagini recente » Cod sursa (job #1637605) | Cod sursa (job #2428416) | Cod sursa (job #459433) | Cod sursa (job #2683962) | Cod sursa (job #357586)
Cod sursa(job #357586)
var v:array[1..1000]of longint;
a,b,p,u,aux,rez:longint;
ok:boolean;
begin
assign(input,'multiplu.in');reset(input);
assign(output,'multiplu.out');rewrite(output);
read(a,b);
v[1]:=1;
ok:=false;
p:=1; u:=1;
while not ok do begin
aux:=v[p]*10;
inc(u); v[u]:=aux;
if (aux mod a=0)and(aux mod b=0) then begin
ok:=true;
rez:=aux;
end;
aux:=(v[p]*10)+1;
inc(u); v[u]:=aux;
if (aux mod a=0)and(aux mod b=0)then begin
ok:=true;
rez:=aux;
end;
inc(p);
end;
write(rez);
close(output);
end.