Initial commit

This commit is contained in:
Lynn Ochs 2020-12-03 22:34:39 +01:00
commit 2c6dc6e8be
4 changed files with 9 additions and 0 deletions

2
01-1-1.py Normal file
View File

@ -0,0 +1,2 @@
l=set(map(int,open("/dev/stdin").readlines()))
print([a*(2020-a) for a in l if 2020-a in l])

2
01-2-1.py Normal file
View File

@ -0,0 +1,2 @@
l=list(map(int, open("/dev/stdin").readlines()))
print([a*b*c for a in l for b in l for c in l if a+b+c==2020])

1
02-1-1.py Normal file
View File

@ -0,0 +1 @@
print(sum(1 for l in map(lambda x:x.split(),open("/dev/stdin").readlines()) if int(l[0].split('-')[0])<=l[2].count(l[1][0])<=int(l[0].split('-')[1])))

4
02-2-1.py Normal file
View File

@ -0,0 +1,4 @@
def chk(k):
a,b,c=*map(int,k[0].split('-')),k[1][0]
return (k[2][a-1]==c)^(k[2][b-1]==c)
print(sum(chk(x.split()) for x in open("/dev/stdin").readlines()))