Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa52f4b

Browse files
authored
Update count-number-of-trapezoids-ii.py
1 parentc719d6d commitaa52f4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎Python/count-number-of-trapezoids-ii.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def countTrapezoids(self, points):
1414
defgcd(a,b):
1515
whileb:
1616
a,b=b,a%b
17-
returna
17+
returnabs(a)
1818

1919
lookup_slope=collections.defaultdict(int)
2020
lookup_line=collections.defaultdict(int)
@@ -26,7 +26,7 @@ def gcd(a, b):
2626
forjinxrange(i):
2727
x2,y2=points[j]
2828
dx,dy=x2-x1,y2-y1
29-
g=abs(gcd(dx,dy))
29+
g=gcd(dx,dy)
3030
a,b=dx//g,dy//g
3131
ifa<0or (a==0andb<0):
3232
a,b=-a,-b

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp