Guest User

day9part1

a guest
Dec 9th, 2025
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | Source Code | 0 0
  1. points = []
  2. with open("day9_input.txt") as f:
  3.     line = f.readline()
  4.     while line:
  5.         points.append(tuple([int(n) for n in line.split(',')]))
  6.         line = f.readline()
  7.        
  8. def area(c1, c2):
  9.     x1, y1 = c1
  10.     x2, y2 = c2
  11.     return (abs(x1-x2)+1)*(abs(y1-y2)+1)
  12.    
  13. largest = 0
  14. for i, c1 in enumerate(points):
  15.     for c2 in points[i+1:]:
  16.         largest = max(largest, area(c1,c2))
  17.  
  18. print(largest)
Advertisement
Add Comment
Please, Sign In to add comment