Advertisement
WarPie90

Untitled

Mar 16th, 2017
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.41 KB | None | 0 0
  1. Program hmm;
  2. {$R-}
  3.  
  4. const
  5.   n   = 2000;
  6.   len = 10*n div 3;
  7.  
  8. var
  9.   i, j:Int32;
  10.   q, x, a: Int32;
  11.  
  12.   tm: Int64;
  13. begin
  14.   tm := GetTickCount();
  15.  
  16.   for j:=1 to n do
  17.   begin
  18.     q := 0;
  19.     a := 2;
  20.     for i:=len downto 1 do
  21.     begin
  22.       x    := 10*a + q*i;
  23.       a    := x mod (2*i - 1);
  24.       q    := x div (2*i - 1);
  25.     end;
  26.   end;
  27.  
  28.   writeln('Used ' + ToStr(GetTickCount() - tm) + ' ms');
  29. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement