ArinaRaguzina

Untitled

Nov 13th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. program AiSDB;
  2.  
  3. var
  4. d, m, b, i, n: integer;
  5. hmax,h:int64;
  6. mas: array [1..100000] of int64;
  7. begin
  8. Assign(input, 'input.txt');
  9. Assign(output, 'output.txt');
  10. reset(input);
  11. rewrite(output);
  12. Read(d, m);
  13. for n := 1 to m do
  14. begin
  15. h := 1;
  16. hmax := 1;
  17. repeat
  18. b := 2 * n - d * (h - 1) * h;
  19. if b <= 0 then
  20. break;
  21. if (b mod (2 * h) = 0) then begin
  22. hmax := h;
  23. mas[n] := hmax;
  24. end;
  25. h += 1;
  26. until (h > n);
  27.  
  28. end;
  29. for i := 1 to n-1 do
  30. Write(mas[i],' ');
  31. write(mas[n]);
  32. Close(input);
  33. Close(output);
  34. end.
Advertisement
Add Comment
Please, Sign In to add comment