回答編集履歴
4
Update
test
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
n = f.read().splitlines()
|
28
28
|
|
29
29
|
# transpose
|
30
|
-
n = [''.join(l) for l in
|
30
|
+
n = [''.join(l) for l in zip(*n)]
|
31
31
|
|
32
32
|
# matching
|
33
33
|
def pattern_matching(blk):
|
3
Update
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
```text
|
3
3
|
**** * * * **** **** **** **** **** **** ****
|
4
4
|
| | | | | | | | | | | | | | |
|
5
|
-
**** * **** **** **** **** * *
|
5
|
+
**** * **** **** **** **** * * * * **** ****
|
6
6
|
| | | | | | | | | | | | |
|
7
7
|
**** * * **** **** **** **** * **** ****
|
8
8
|
```
|
@@ -17,7 +17,7 @@
|
|
17
17
|
['*|* ', ' * ', ' * ', '*|*|*'], # 4
|
18
18
|
['*|* *', '* * *', '* * *', '* *|*'], # 5
|
19
19
|
['*|*|*', '* * *', '* * *', '* *|*'], # 6
|
20
|
-
['*|
|
20
|
+
['*|* ', '* ', '* ', '*|*|*'], # 7
|
21
21
|
['*|*|*', '* * *', '* * *', '*|*|*'], # 8
|
22
22
|
['*|* *', '* * *', '* * *', '*|*|*'], # 9
|
23
23
|
]
|
@@ -27,7 +27,7 @@
|
|
27
27
|
n = f.read().splitlines()
|
28
28
|
|
29
29
|
# transpose
|
30
|
-
n = [''.join(l) for l in
|
30
|
+
n = [''.join(l) for l in [*zip(*n)]]
|
31
31
|
|
32
32
|
# matching
|
33
33
|
def pattern_matching(blk):
|
2
Update
test
CHANGED
@@ -48,9 +48,7 @@
|
|
48
48
|
blk.append(l)
|
49
49
|
|
50
50
|
# last number
|
51
|
-
if blk:
|
52
|
-
|
51
|
+
lst.append(pattern_matching(blk))
|
53
|
-
if i: lst.append(i)
|
54
52
|
|
55
53
|
print(lst)
|
56
54
|
|
1
Update
test
CHANGED
@@ -42,11 +42,8 @@
|
|
42
42
|
for l in n:
|
43
43
|
if l == sep:
|
44
44
|
if not blk: continue
|
45
|
-
|
45
|
+
lst.append(pattern_matching(blk))
|
46
|
-
if i is not None:
|
47
|
-
lst.append(i)
|
48
46
|
blk = []
|
49
|
-
continue
|
50
47
|
else:
|
51
48
|
blk.append(l)
|
52
49
|
|