array.pp 724 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. { Array Access }
  2. Program ary3;
  3. uses SysUtils, Classes;
  4. var
  5. n, i, k, last : longint;
  6. X, Y : TList;
  7. begin
  8. if ParamCount = 0 then
  9. n := 1
  10. else
  11. n := StrToInt(ParamStr(1));
  12. if n < 1 then n := 1;
  13. last := n - 1;
  14. X := TList.Create;
  15. X.Capacity := n;
  16. For i := 0 To last do
  17. X.Add( Pointer(i+1) );
  18. Y := TList.Create;
  19. Y.Capacity := n;
  20. For i := 0 To last do
  21. Y.Add( Pointer(0) );
  22. For k := 0 To 999 do
  23. begin
  24. For i := last downto 0 do
  25. begin
  26. Y.Items[i] := Pointer(longint(Y.Items[i]) + longint(X.Items[i]));
  27. end;
  28. end;
  29. Writeln (IntToStr(longint(Y.Items[0])), ' ', IntToStr(longint(Y.Items[last])));
  30. end.