09-1
This commit is contained in:
26
09/09-1.py
Normal file
26
09/09-1.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# file = "./ex.txt"
|
||||
file = "./input.txt"
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution = 0
|
||||
positions = []
|
||||
input_file = open(file, "r")
|
||||
for line in input_file:
|
||||
line = line.strip()
|
||||
if line == "":
|
||||
continue
|
||||
else:
|
||||
a,b = line.split(',')
|
||||
a = int(a)
|
||||
b = int(b)
|
||||
positions.append([a,b])
|
||||
|
||||
for i in range(len(positions)):
|
||||
for j in range(i+1, len(positions)):
|
||||
area = (abs(positions[i][0]-positions[j][0])+1)*(abs(positions[i][1]-positions[j][1])+1)
|
||||
if area > solution:
|
||||
solution = area
|
||||
print(f"Solution: {solution}")
|
||||
Reference in New Issue
Block a user