<aside> ๐ก
์๋ฎฌ๋ ์ด์ ๋ฌธ์ ์์๋ 2์ฐจ์ ๊ณต๊ฐ์์์ ์์ ํ์ ๋ฐ ๋ฐฉํฅ ๋ฒกํฐ๊ฐ ์์ฃผ ํ์ฉ๋จ
</aside>
์ฌํ๊ฐ๊ฐ NN ํฌ๊ธฐ์ ์ ์ฌ๊ฐํ ๊ณต๊ฐ ์์ ์ ์๋ค. ๊ฐ์ฅ ์ผ์ชฝ ์ ์ขํ๋ (1,1)์ด๋ฉฐ, ์ค๋ฅธ์ชฝ ์๋๋ (N,N)์ด๋ค.
์ฌํ๊ฐ๋ ์ํ์ข์ฐ๋ก ํ์นธ์ฉ ์ด๋ํ ์ ์์ผ๋ฉฐ ์์์ขํ๋ (1,1)์ด๋ค. LRUD์ ๋ฌธ์์ด์ ๋ฐ์์ ๋ง์ง๋ง์ ์ฌํ๊ฐ๊ฐ ์์นํ ์ฃํ๋ฅผ ๊ตฌํด๋ผ. ์ด๋ NNํฌ๊ธฐ์ ์ ์ฌ๊ฐํ ๊ณต๊ฐ์ ๋ฒ์ด๋๋ ์์ง์์ ๋ฌด์๋๋ค.
n = int(input())
moves = input()
arr = moves.split(' ')
loc = [1,1]
# LRUD
dx = [-1,1,0,0]
dy = [0,0,-1,1]
for move in arr:
if(move == 'L'):
if loc[1] <= 1:
continue
else: loc[1]-=1
if(move == 'R'):
if loc[1] >= n:
continue
else:
loc[1]+=1
if(move == 'U'):
if loc[0] <=1:
continue
else: loc[0]-=1
if(move == 'D'):
if loc[0] >= n:
continue
else: loc[0]+=1
print(loc)
์ ์ N์ด ์ ๋ ฅ๋๋ฉด 00์ 00๋ถ 00์ด๋ถํฐ N์ 59๋ถ 59์ด๊น์ง ๋ชจ๋ ์๊ฐ์ค์์ 3์ด ํ๋๋ผ๋ ํฌํจ๋๋ ๋ชจ๋ ๊ฒฝ์ฐ์ ์๋ฅผ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํด๋ผ.
๊ฐ๋ฅํ ๋ชจ๋ ์๊ฐ์ ๊ฒฝ์ฐ๋ฅผ ํ๋์ฉ ๋ชจ๋ ์ธ์ ํ ์ ์๋ค
์์ ํ์(brute forcing) = ๊ฐ๋ฅํ ๊ฒฝ์ฐ์ ์๋ฅผ ๋ชจ๋ ๊ฒ์ฌํด๋ณด๋ ํ์๋ฐฉ๋ฒ
h = int(input())
count = 0
for i in range(h+1):
for j in range(60):
for k in range(60):
if '3' in str(i) + str(j) + str(k):
count+=1
print(count)
8*8์ ์ฒด์คํ ์์์ ํน์ ์ขํ๊ฐ ์ฃผ์ด์ก์ ๋ ๋์ดํธ๊ฐ ์ด๋ ๊ฐ๋ฅํ ์์น์ ์๋ฅผ ๊ตฌํด๋ผ ๋์ดํธ๋ 2๊ฐ์ง ๊ฒฝ์ฐ๋ก ์ด๋ํ ์ ์๋ค.
loc = input()
row = int(loc[1])
col = int(ord(loc[0]) - ord('a')) + 1
steps = [(-2,-1), (-1,-2), (1,-2), (2, -1), (2,1), (1,2), (-1,2) , (-2,1) ]
result = 0
for step in steps:
next_row = row+step[0]
next_col = col+step[1]
if next_row >=1 and next_row <=8 and next_col >=1 and next_col <=8:
result+=1
print(result)
์ํ๋ฒณ ๋๋ฌธ์์ ์ซ์(0~9)๋ก๋ง ์ด๋ฃจ์ด์ง ๋ฌธ์์ด์ด ์ ๋ ฅ์ผ๋ก ์ฃผ์ด์ก์ ๋ ๋ชจ๋ ์ํ๋ฒณ์ ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌํ๊ณ ๊ทธ ๋ค์ ๋ชจ๋ ์ซ์๋ฅผ ๋ํ ๊ฐ์ ์ด์ด์ ์ถ๋ ฅํด๋ผ.
input = input()
arr = list(input)
sum = 0
char_arr = []
for el in arr:
if el.isalpha():
char_arr.append(el)
else:
sum+=int(el)
print(''.join(sorted(char_arr)) + str(sum))