промежутое
This commit is contained in:
28
programm4.py
Normal file
28
programm4.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from math import gcd
|
||||
|
||||
def normalize_direction(x, y):
|
||||
if x == 0 and y == 0:
|
||||
return (0, 0)
|
||||
|
||||
g = gcd(abs(x), abs(y))
|
||||
x //= g
|
||||
y //= g
|
||||
|
||||
return (x, y)
|
||||
|
||||
with open('INPUT.TXT', 'r') as f:
|
||||
n = int(f.readline())
|
||||
targets = []
|
||||
for _ in range(n):
|
||||
x, y = map(int, f.readline().split())
|
||||
targets.append((x, y))
|
||||
|
||||
directions = {}
|
||||
for x, y in targets:
|
||||
direction = normalize_direction(x, y)
|
||||
directions[direction] = directions.get(direction, 0) + 1
|
||||
|
||||
max_targets = max(directions.values())
|
||||
|
||||
with open('OUTPUT.TXT', 'w') as f:
|
||||
f.write(str(max_targets))
|
||||
Reference in New Issue
Block a user