擅长:python、mysql、java
<p>您可以使用<code>O(n^2)</code>中的半径<code>radius</code>填充圆内的所有点,而不是绘制直线:</p>
<pre class="lang-py prettyprint-override"><code># Your code here
for x in range(radius):
for y in range(radius):
if x**2 + y**2 < radius**2:
pixels[ x + 500 , y-500] = (255,255,0)
pixels[ x + 500 , -y-500] = (255,255,0)
pixels[ -x + 500 , y-500] = (255,255,0)
pixels[ -x + 500 , -y-500] = (255,255,0)
img.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/rjPoq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rjPoq.png" alt="enter image description here"/></a></p>