βοΈ λ¬Έμ
βοΈ μ λ ₯
# 1. 곡κ°μ ν¬κΈ° Nμ λ°λλ€.
N = int(input())
# 2. μ΄λν κ³νμ λ°λλ€.
plans = input().split()
# 3. νμ¬ μ’ν (1,1)μ κΈ°λ³ΈμΌλ‘ νλ€.
x, y = 1, 1
# μμ§μ νμ
μ μ μνμ
move_types = ['L', 'R', 'U', 'D']
# λ¨μ벑ν°λ₯Ό μ μνμ
dx = [0, 0, -1, 1]
dy = [-1, 1, 0, 0]
# 4. κ³νμ λͺ¨λ λ°λ³΅μν¨λ€
for plan in plans:
# 5. λ§μ½ κ³νκ³Ό L R U D μ€ νλλΌ μΌμΉ λλ€λ©΄ μμ§μ¬μΌνλ μ’νλ₯Ό λ³μμ λ£μ
for i in range(len(move_types)):
if plan == move_types[i]:
nx = x + dx[i]
ny = y + dy[i]
# 6. μμ§μΈ λμ΄ κ³΅κ°μ λμ΄κ°λ€λ©΄
if nx < 1 or ny < 1 or nx > N or ny > N:
# 7. continueνμ
continue
# 8. κ·Έ λ°©ν₯μΌλ‘ μμ§μ΄μ
x, y = nx, ny
print(x, y)
π» μΆλ ₯
>5
>R R R U D D
3 4
01. μκ°
βοΈ λ¬Έμ
πΆοΈ ν΄μ€
-> νμ΄μ¬μ 1μ΄μ 2000λ§λ² μ λ κ³μ°νλ€κ³ μκ°νκ³ νλ©΄ μ’μ!
βοΈ μ λ ₯
N = int(input())
count = 0
for i in range(N+1):
for j in range(60):
for k in range(60):
if '3' in str(i) + str(j) + str(k):
count += 1
print(count)
π» μΆλ ₯
>5
11475
02. μμ€μ λμ΄νΈ
βοΈ λ¬Έμ
πΆοΈ ν΄μ€
βοΈ μ λ ₯
# νμ¬ μμΉλ₯Ό λ°λλ€
input_data = input()
row = int(input_data[1])
column = int(ord(input_data[0])) - int(ord('a')) + 1
# λ°©ν₯ 벑ν°λ₯Ό μ€μ νλ€.
dirs = [(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)]
result = 0
for dir in dirs:
next_row = row + dir[0]
next_col = column + dir[1]
if next_row >= 1 and next_row <= 8 and next_col >= 1 and next_col <= 8:
result += 1
print(result)
π» μΆλ ₯
>a1
2
03. λ¬Έμμ΄ μ¬μ λ ¬
βοΈ λ¬Έμ
-> μ vs μ«μ
μ : 100, 700. 98323 λ± νμ리 μ΄μΈμ μ
μ«μ : 0~9 κΉμ§ νμ리μ μ«μ
πΆοΈ ν΄μ€
βοΈ μ λ ₯
datas = input()
result = []
sum = 0
# λ°μ΄ν°λ₯Ό νλμ© κ²μ¬νλ€.
for data in datas:
# λ§μ½ μνλ²³μΈ κ²½μ°
if data.isalpha():
# resultμ λ£μ΄μ€λ€.
result.append(data)
# κ·Έλ μ§ μλ€λ©΄
else:
# sum μ«μλ₯Ό λν΄μ€λ€.
sum += int(data)
# result μ λ ¬
result.sort()
# sum μ resultμ λ£μ΄μ£Όμ
result.append(str(sum))
# result μΆλ ₯νμ.
print(''.join(result))
π» μΆλ ₯
>K1KA5CB7
ABCKK13
[μΆμ²] μ΄κ²μ΄ μ·¨μ
μ μν μ½λ© ν
μ€νΈλ€ with νμ΄μ¬ (λλλΉ μ§μ)