Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- AWS
- creon login
- RecursionError: maximum recursion depth exceeded while calling a Python object
- Web Crawler
- Creon
- URI
- Slack
- Daishin Securities
- Version Control
- Auto Login
- request param
- handleMethodsArgumentNotValid
- stock trading
- AESCipher
- python
- header
- mongodb
- Rest
- The Internet
- API
- ExceptionHandler
- spec
- mime type
- WebServer
- automated system
- pyinstaller
- KOSDAQ
- Stock
- EC2
- Instance
Archives
- Today
- Total
Change the Better World
Implement 본문
Up Down Left Right
n = int(input())
x, y = 1, 1
plans = input().split()
dx = [0, 0, -1, 1]
dy = [-1, 1, 0, 0]
move_types = ['L', 'R', 'U', 'D']
for plan in plans:
for i in range(len(move_types)):
if plan == move_types[i]:
nx = x + dx[i]
ny = y + dy[i]
break
if nx < 1 or ny < 1 or nx > n or ny > n:
continue
x, y = nx, ny
print(x, y)
Time
N = int(input())
cnt = 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):
cnt += 1
print(cnt)
Knight Of King
input_data = input()
row = int(input_data[1])
column = int(ord(input_data[0])) - int(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: int = row + step[0]
next_column: int = column + step[1]
if next_row >= 1 and next_row <=8 and next_column >= 1 and next_column <= 8:
result += 1
print(result)
'Algorithm' 카테고리의 다른 글
Greedy Algorithm (2) - law of large numbers (0) | 2021.09.15 |
---|---|
Greedy Algorithm(1) - Change (0) | 2021.09.11 |
Comments