Cod sursa(job #164446)
Utilizator | Data | 24 martie 2008 11:16:05 | |
---|---|---|---|
Problema | Algoritmul lui Euclid extins | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
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.