04 løsning

This commit is contained in:
Rasmus Malver 2022-12-04 12:14:31 +01:00
parent 7eb1a1ee1e
commit 464a35a5ac
2 changed files with 1014 additions and 0 deletions

14
04/2022-12-04-AB.py Normal file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env python3
result = [0,0]
import re
for l in open("04/i").readlines():
a = list(map(int,re.split("[,-]",l.strip())))
b = len(set(range(a[0],a[1]+1)).intersection(range(a[2],a[3]+1)))
if b == len(range(a[0],a[1]))+1 or b == len(range(a[2],a[3]))+1:
result[0]+=1
result[1]+=1
elif b != 0:
result[0]+=1
print(result)

1000
04/i Normal file

File diff suppressed because it is too large Load diff