Day 04 (minified)
This commit is contained in:
3
day04/part1.min.py
Normal file
3
day04/part1.min.py
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
print(sum(b>=x<=a<=y>=b or y>=a<=x<=b>=y for a,b,x,y in(map(int,l.strip().replace(',', '-').split('-'))for l in open("input.txt"))))
|
||||
@@ -8,3 +8,4 @@ for line in lines:
|
||||
s += 1 if b >= x <= a <= y >= b or y >= a <= x <= b >= y else 0
|
||||
|
||||
print(s)
|
||||
print(sum(b >= x <= a <= y >= b or y >= a <= x <= b >= y for a, b, x, y in (map(int, l.strip().replace(',', '-').split('-')) for l in open("input.txt"))))
|
||||
|
||||
3
day04/part2.min.py
Normal file
3
day04/part2.min.py
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
print(sum(x<=a<=y or x<=b<=y or a<=x<= b or a<=y<=b for a,b,x,y in(map(int,l.strip().replace(',', '-').split('-'))for l in open("input.txt"))))
|
||||
Reference in New Issue
Block a user