浏览代码

Get rid of reduce() in 2020 day 6

Taddeus Kroes 5 年之前
父节点
当前提交
7f8b3f0600
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      2020/06_customs.py

+ 2 - 3
2020/06_customs.py

@@ -1,6 +1,5 @@
 #!/usr/bin/env python3
 import sys
-from functools import reduce
 
 def parse(f):
     cur = []
@@ -13,5 +12,5 @@ def parse(f):
     yield cur
 
 groups = list(parse(sys.stdin))
-print(sum(len(reduce(set.union, map(set, g))) for g in groups))
-print(sum(len(reduce(set.intersection, map(set, g))) for g in groups))
+print(sum(len(set.union(*map(set, g))) for g in groups))
+print(sum(len(set.intersection(*map(set, g))) for g in groups))