Pagini recente » Cod sursa (job #428825) | Cod sursa (job #1264761) | Cod sursa (job #1763685) | Cod sursa (job #1260429) | Cod sursa (job #109417)
Cod sursa(job #109417)
program p1;
var fin,fout:text;
a,b,c,d,x,y,z,o,i,j,k,a1,c1:integer;
s:string;
begin
assign(fin,'ecuatie.in');
reset(fin);
read(fin,a,b,c,d);
close(fin);
if a<0 then
a1:=a*(-1);
if c<0 then
c1:=c*(-1);
for i:=((-1)*a1) to a1 do
if a mod i=0 then
begin
x:=i;
z:=a div i;
end;
for j:=((-1)*c1) to c1 do
begin
y:=j;
o:=c div j;
if (c mod j=0) and (y*z+x*o=c) then
k:=k+1;
if k=d then
begin
assign(fout,'ecuatie.out');
rewrite(fout);
write(fout,'(');
str(x,s);
write(fout,s);
str(y,s);
write(fout,s);
write(fout,') ');
write(fout,'(');
str(z,s);
write(fout,s);
str(o,s);
write(fout,s);
write(fout,')');
close(fout);
end;
end;
end.