Pagini recente » Cod sursa (job #2488477) | Cod sursa (job #2865587) | Cod sursa (job #3237584) | Cod sursa (job #3291034) | Cod sursa (job #164445)
Cod sursa(job #164445)
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:=0 to c div a do
for y:=0 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.