Skip to content

Commit 7c0d55f

Browse files
Avoid integer overflow
1 parent f06ae83 commit 7c0d55f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

TapWork.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ def get_taps_demand(taps,houses):
2929
if tap_dist < lowest_distance:
3030
lowest_distance = tap_dist
3131
house_tap = taps.index(tap)
32+
lowest_distance = lowest_distance / 1000
3233
# weight the distance^2 by the size to give a score
33-
houses_tap.append((house_tap,((lowest_distance**4)*(house[0]**2))/ 10000))
34+
houses_tap.append((house_tap,((lowest_distance**4)*(house[0]**2))/ 1000))
3435

3536
for tap in houses_tap:
3637
tap_demand[tap[0]]+=tap[1]

0 commit comments

Comments
 (0)