first fix
This commit is contained in:
29
02/02.py
29
02/02.py
@@ -12,20 +12,23 @@ sol = 0
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.replace('\n', "")
|
line = line.replace('\n', "")
|
||||||
gameid = line.split(":")[0].split(" ")[1]
|
gameid = line.split(":")[0].split(" ")[1]
|
||||||
game = line.split(":")[1].split(",")
|
game = line.split(":")[1].split(";")
|
||||||
valid = True
|
valid = True
|
||||||
for color in game:
|
for pull in game:
|
||||||
temp = color.split(' ')
|
colors = pull.split(',')
|
||||||
if 'red' in temp[1]:
|
for color in colors:
|
||||||
if int(temp[0]) > maxred:
|
temp = color.split(' ')
|
||||||
valid = False
|
if 'red' in temp[2]:
|
||||||
elif 'green' in temp[1]:
|
if int(temp[1]) > maxred:
|
||||||
if int(temp[0]) > maxgreen:
|
valid = False
|
||||||
valid = False
|
elif 'green' in temp[2]:
|
||||||
elif 'blue' in temp[1]:
|
if int(temp[1]) > maxgreen:
|
||||||
if int(temp[0]) > maxblue:
|
valid = False
|
||||||
valid = False
|
elif 'blue' in temp[2]:
|
||||||
|
if int(temp[1]) > maxblue:
|
||||||
|
valid = False
|
||||||
if not valid:
|
if not valid:
|
||||||
sol += gameid
|
print(gameid)
|
||||||
|
sol += int(gameid)
|
||||||
|
|
||||||
print(sol)
|
print(sol)
|
||||||
|
Reference in New Issue
Block a user