remove readlines
This commit is contained in:
parent
51c8d0d12a
commit
8a4688ecab
|
@ -1,2 +1,2 @@
|
||||||
l=set(map(int,open("/dev/stdin").readlines()))
|
l=set(map(int,open("/dev/stdin")))
|
||||||
print([a*(2020-a) for a in l if 2020-a in l])
|
print([a*(2020-a) for a in l if 2020-a in l])
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
l=list(map(int,open("/dev/stdin").readlines()))
|
l=list(map(int,open("/dev/stdin")))
|
||||||
print([a*b*c for a in l for b in l for c in l if a+b+c==2020])
|
print([a*b*c for a in l for b in l for c in l if a+b+c==2020])
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
print(sum(int((s:=l[0].split('-'))[0])<=l[2].count(l[1][0])<=int(s[1]) for l in map(str.split,open("/dev/stdin").readlines())))
|
print(sum(int((s:=l[0].split('-'))[0])<=l[2].count(l[1][0])<=int(s[1]) for l in map(str.split,open("/dev/stdin"))))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
def f(k):
|
def f(k):
|
||||||
a,b,c=*map(int,k[0].split('-')),k[1][0]
|
a,b,c=*map(int,k[0].split('-')),k[1][0]
|
||||||
return (k[2][a-1]==c)^(k[2][b-1]==c)
|
return (k[2][a-1]==c)^(k[2][b-1]==c)
|
||||||
print(sum(f(x.split()) for x in open("/dev/stdin").readlines()))
|
print(sum(f(x.split()) for x in open("/dev/stdin")))
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
print(sum('#'==open('/dev/stdin').readlines()[i][(i*3)%31] for i in range(323)))
|
print(sum('#'==list(open('/dev/stdin'))[i][(i*3)%31] for i in range(323)))
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
d=open("/dev/stdin").readlines()
|
d=list(open("/dev/stdin"))
|
||||||
def f(y,x=1):return sum(d[i][i*y//x%31]=='#' for i in range(0,323,x))
|
def f(y,x=1):return sum(d[i][i*y//x%31]=='#' for i in range(0,323,x))
|
||||||
print(f(1)*f(3)*f(5)*f(7)*f(1,2))
|
print(f(1)*f(3)*f(5)*f(7)*f(1,2))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user