Как дополнить любое число до целого квадрата умножением? То-есть есть число 12, и чтоб дополнить до целого квадрата нужно домножить на 3. Как доделать такую программу в общем случае? Питон
Uses graphabc; var i, j: integer; ar: array[1..10]of integer; b: boolean;
label l1; begin b := false; for i := 1 to 10 do ar[i] := random(10, 300); l1: b := false; for i := 1 to 10 do for j := 1 to 10 do if((ar[i] = ar[j]) or (abs(ar[i] - ar[j]) < 10)) and (i <> j) then begin b := true; ar[i] := random(30, 300); end; if b = true then goto l1; window.Init(0, 0, 800, 600, clwhite); window.IsFixedSize := true; randomize; lockdrawing; pen.Width := 5; for i := 1 to 10 do begin pen.Color := rgb(random(0, 255), random(0, 255), random(0, 255)); drawcircle(400, 300, ar[i]); redraw; end; end.
Uses graphabc; var i, j: integer; ar: array[1..10]of integer; b: boolean;
label l1; begin b := false; for i := 1 to 10 do ar[i] := random(10, 300); l1: b := false; for i := 1 to 10 do for j := 1 to 10 do if((ar[i] = ar[j]) or (abs(ar[i] - ar[j]) < 10)) and (i <> j) then begin b := true; ar[i] := random(30, 300); end; if b = true then goto l1; window.Init(0, 0, 800, 600, clwhite); window.IsFixedSize := true; randomize; lockdrawing; pen.Width := 5; for i := 1 to 10 do begin pen.Color := rgb(random(0, 255), random(0, 255), random(0, 255)); drawcircle(400, 300, ar[i]); redraw; end; end.
var
i, j: integer;
ar: array[1..10]of integer;
b: boolean;
label l1;
begin
b := false;
for i := 1 to 10 do ar[i] := random(10, 300);
l1:
b := false;
for i := 1 to 10 do
for j := 1 to 10 do if((ar[i] = ar[j]) or (abs(ar[i] - ar[j]) < 10)) and (i <> j)
then
begin
b := true;
ar[i] := random(30, 300);
end;
if b = true then goto l1;
window.Init(0, 0, 800, 600, clwhite);
window.IsFixedSize := true;
randomize;
lockdrawing;
pen.Width := 5;
for i := 1 to 10 do
begin
pen.Color := rgb(random(0, 255), random(0, 255), random(0, 255)); drawcircle(400, 300, ar[i]);
redraw;
end;
end.
var
i, j: integer;
ar: array[1..10]of integer;
b: boolean;
label l1;
begin
b := false;
for i := 1 to 10 do ar[i] := random(10, 300);
l1:
b := false;
for i := 1 to 10 do
for j := 1 to 10 do if((ar[i] = ar[j]) or (abs(ar[i] - ar[j]) < 10)) and (i <> j)
then
begin
b := true;
ar[i] := random(30, 300);
end;
if b = true then goto l1;
window.Init(0, 0, 800, 600, clwhite);
window.IsFixedSize := true;
randomize;
lockdrawing;
pen.Width := 5;
for i := 1 to 10 do
begin
pen.Color := rgb(random(0, 255), random(0, 255), random(0, 255)); drawcircle(400, 300, ar[i]);
redraw;
end;
end.