Pagini recente » Cod sursa (job #492716) | Cod sursa (job #1415733) | Cod sursa (job #1445633) | Cod sursa (job #1732684) | Cod sursa (job #164446)
Cod sursa(job #164446)
var a,b,c,x,y,t,i:longint;
ok:boolean;
begin
assign(input,'euclid3.in');reset(input);
assign(output,'euclid3.out');rewrite(output);
read(t);
for i:=1 to t do begin
read(a,b,c);ok:=true;
for x:=-(c div a) to c div a do
for y:=-(c div b) to c div b do begin
if a*x+b*y=c then begin ok:=false;writeln(x,' ',y);break;end;
if not ok then break;
end;
if ok then writeln('0 0');
end;
close(input);close(output);
end.