
# 초기 변수 설정
X = 1
Y = 1
num = int(input()) # num X num 배열
plans = input()
for plan in plans:
if plan == 'L':
if X == 1:
continue
else:
X -= 1
elif plan == "R":
if X == num:
continue
else:
X += 1
elif plan == "D":
if Y == num:
continue
else:
Y += 1
elif plan == "U":
if Y == 1:
continue
else:
Y -= 1
print(Y, X)

N = int(input())
count = 0
for hour in range(N+1):
for min in range(60):
for sec in range(60):
time = f"{hour}시 {min}분 {sec}초"
if '3' in time:
count += 1
print(count)
핵심 포인트
col = ord(now[0]) - ord('a') +1
→ 1열이 a가 될 수 있게 설정
now = input()
dx = [-2, -2, 2, 2, -1, 1, -1, 1]
dy = [-1, 1, -1, 1, -2, -2, 2, 2]
row = int(now[1])
col = ord(now[0]) - ord('a') +1
count = 0
for i in range(8):
new_row = row + dx[i]
new_col = col + dy[i]
if 1 <= new_row <= 8 and 1 <= new_col <= 8:
count += 1
print(count)