Cod sursa(job #164445)
| Utilizator | Data | 24 martie 2008 11:14:12 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid extins | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 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:=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.
