промежутое

This commit is contained in:
2025-12-05 11:48:13 +05:00
parent 30647281a5
commit dcb80ef973
48 changed files with 1190 additions and 0 deletions

28
programm4.py Normal file
View 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))