https://www.acmicpc.net/problem/2641
Key Point
from collections import deque
convert = lambda x: (x + 2) % 4 if x != 2 else 4
n = int(input())
data = deque(map(int, input().split()))
rev_data = deque(map(convert, data))
rev_data.reverse()
count = 0
result = []
for _ in range(int(input())):
cur = deque(map(int, input().split()))
tmp = cur.copy()
for _ in range(n):
if data == tmp or rev_data == tmp:
count += 1
result.append(cur)
tmp.rotate(1)
print(count)
for result_list in result:
print(*result_list)
1. lambda + map 활용
2. deque.rotate() 활용
'백준 알고리즘 (Baekjoon Algorithm)' 카테고리의 다른 글
[파이썬] 백준 알고리즘 No.15815 천재 수학자 성필 (후위 연산자) (0) | 2024.01.19 |
---|---|
[파이썬] 백준 알고리즘 No.1024 수열의 합 (0) | 2024.01.16 |
[파이썬] 백준 알고리즘 No.1308 D-Day (0) | 2024.01.16 |
[파이썬] 백준 알고리즘 No.2477 참외밭 (2) | 2023.02.18 |
[파이썬] 백준 알고리즘 No.11478 서로 다른 부분 문자열의 개수 (0) | 2023.02.18 |