Skip to content

Commit

Permalink
[#5] 이것이 파이썬 코딩테스트다 - 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
hyesuuou committed Feb 7, 2022
1 parent 74dd91e commit fe823b6
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
21 changes: 21 additions & 0 deletions PythonCodingTest/구현/4-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
n = int(input())
data = list(input().split())
print(data)
x = 1
y = 1

for i in data:
if i == 'L':
if x > 1:
x = x-1
elif i == 'R':
if x < n:
x = x + 1
elif i == 'U':
if y > 1:
y = y-1
elif i == 'D':
if y < n:
y = y +1

print(y, x)
9 changes: 9 additions & 0 deletions PythonCodingTest/구현/4-2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
n = int(input())
ans = 0
# 00시 00분 00초~ 00시 59분 59초 1 2
for i in range(n+1):
if i == 3 or i == 13 or i == 23:
ans += 3600
else:
ans += 1575
print(ans)
26 changes: 26 additions & 0 deletions PythonCodingTest/구현/4-3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
s = input()
row = int(s[1]) # 행
col = ord(s[0])-96 # 열
ans = 0

if col+2<=8:
if row-1>=1:
ans += 1
if row+1<=8:
ans += 1
if col-2>=1:
if row-1>=1:
ans += 1
if row+1<=8:
ans += 1
if col+1<=8:
if row-2>=1:
ans += 1
if row+2<=8:
ans += 1
if col-1>=1:
if row-2>=1:
ans += 1
if row+2<=8:
ans += 1
print(ans)

0 comments on commit fe823b6

Please sign in to comment.