HCPC points on this side of a line by David Sharick

def f():
\x09return (int(q) for q in r().split())
r=input
n=int(r())
x1,y1=f()
x2,y2=f()
s=(y2-y1)/(x2-x1)
yi=y2-(x2-1)*s
o=0
for y in range(1,n+1):
\x09for x in range(1,n+1):
\x09\x09t=yi+(x-1)*s;o+=(t>y)^(yi<1)|(t==y)
print(o)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page