fork download
  1. Program divisor;
  2.  
  3. var
  4. A, B, G, K, T, i,test,radq, somma, contadivisori : LongInt;
  5. divis1, divis2:array[1..100000] of longint;
  6.  
  7. procedure trovadivisori (x:longint);
  8. var y,h:longint;
  9.  
  10. begin
  11. y:=2; h:=2;
  12. repeat
  13. if (x mod y =0) then begin divis1[h]:= x div y; divis2[h]:=y; h:=h+1; end;
  14. y:=y+1;
  15. until y>trunc(sqrt(x));
  16. contadivisori:=h-1;
  17. end;
  18.  
  19. begin
  20. { assign(input, 'input.txt'); reset(input);
  21.   assign(output, 'output.txt'); rewrite(output);
  22. }
  23.  
  24. ReadLn(T);
  25. for test:=1 to T do begin
  26. ReadLn(A, B, K);
  27. somma:=A+B+K;
  28. radq:=trunc(sqrt(somma));
  29. divis2[1]:=1; divis1[1]:=somma;
  30. trovadivisori(somma);
  31. for i:=1 to contadivisori do write (divis2[i],' '); writeln;
  32. for i:=1 to contadivisori do write (divis1[i],' '); writeln;
  33. G := 0;
  34. end;
  35. writeln(G);
  36. end.
  37.  
  38.  
Success #stdin #stdout 0s 5272KB
stdin
1
18 9 3
stdout
1 2 3 5 
30 15 10 6 
0