Pagini recente » Cod sursa (job #1229906) | Cod sursa (job #2050104) | Cod sursa (job #2139323) | Cod sursa (job #2670785) | Cod sursa (job #115530)
Cod sursa(job #115530)
program multiplu ;
var a,b,max,max1,max2:longint;
f,g:text;
gasit,ok:boolean;
begin
assign(f,'multiplu.in');
reset(f);
assign(g,'multiplu.out');
rewrite(g);
read(f,a,b);
max1:=0;
if a>b then max:=a
else max:=b;
gasit:=false;
while gasit=false do
begin
max1:=max1+max;ok:=false;
if (max1 mod a)=0 then
begin
max2:=max1;
while (max2<>0)and(ok=false) do
begin
if((max2 mod 10=1)or(max2 mod 10=0))and(((max2 div 10) mod 10=1)or((max2 div 10) mod 10=0))then ok:=true;
max2:=max2 div 100;
end;
end;
if ok then gasit:=true;
end;
if gasit then write(g,max1);
close(f);
close(g);
end.