SlepoiKrot

Untitled

Jan 14th, 2018
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program circle;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   SysUtils;
  7. var
  8.   r, k, u, t, i, j, r2: integer;
  9.   r1: double;
  10. begin
  11.   readln (k, r);
  12.   u := 0;
  13.   r1 := r / k;
  14.   r2 := r;
  15.   if (r mod k <> 0) then
  16.     r := r div k + 1
  17.   else
  18.     r := r div k;
  19.   if (frac(r1) = 0) then begin
  20.     for i := 0 to r do begin
  21.       for j := 0 to r do begin
  22.         if (i * i + j * j = r1 * r1) then begin
  23.           inc (u);
  24.         end;
  25.       end;
  26.       j := 0;
  27.     end;
  28.   end;
  29.   t := 4 * (2 * (r2 div k) + 1) - 4 * u;
  30.   writeln (t);
  31.   readln;
  32.   readln;
  33. end.
RAW Paste Data