04 løsning
This commit is contained in:
parent
7eb1a1ee1e
commit
464a35a5ac
14
04/2022-12-04-AB.py
Normal file
14
04/2022-12-04-AB.py
Normal 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)
|
Loading…
Reference in a new issue