fork download
  1. var t, i, n, sum, j : longint;
  2. begin
  3. readln(t);
  4. for i:=1 to t do
  5. begin
  6. readln(n);
  7. sum:=0;
  8. for j:=(n-1) downto 1 do
  9. begin
  10. if n mod j = 0 then sum:=sum+j;
  11. end;
  12. writeln(sum);
  13. end;
  14. end.
Success #stdin #stdout 0s 9136KB
stdin
1
99999
stdout
48513