Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
19 changes: 19 additions & 0 deletions 17주차/(P)60059/(P)60059_python_최범준.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def rotation(array, n): #array라는 2차원 배열을 시계방향으로 90도 n번 돌리는 함수
#시계 돌리는 알고리즘을 구현을 못하겠습니다. ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 문제 어렵죠 조금 더 시간을 가지고 고민해보면 할수 있습니다!

array = array
return array

def check(key, lock): #key와 lock 각 2차원 배열이 문제 조건에 통과할 수 있는지 check하는 함수
#통과하는 조건을 알고리즘을 구현을 못하겠습니다.. ㅜㅜ
flag = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flag로 체크하는 것 굿굿 👍

return flag


def solution(key, lock):
answer = False

for i in range(1, 5): #시계방향으로 돌려가며 확인한다.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for 문 체크 굿굿 👍

new_key = rotation(key, i)
answer = check(new_key, lock)

return answer
31 changes: 31 additions & 0 deletions 17주차/20055/(P)20055_python_최범준.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from collections import deque

# 로봇이 존재하는 자료구조, 벨트의 내구성을 나타내는 자료구조를 두개를 따로 사용
n,k = map(int,input().split())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자료구조 두개로 따로 사용하는것 굿굿 👍


belt = deque(map(int,input().split()))
robot_existence = deque(list([0]*n)) #로봇은 0~n 에 존재(내리는 위치 때문에)

result = 0

while belt.count(0) < k:
#한 칸씩 돌리기
belt.rotate(1) #벨트 돌리기
robot_existence.rotate(1) #로봇의 위치 이동

robot_existence[-1] = 0 #맨 마지막 로봇이 있는 자리는 내리는 칸이기에 0으로 setting

if sum(robot_existence) > 0 : #로봇이 하나라도 존재하는 경우
for i in range(n-2,-1,-1):
if robot_existence[i] == 1 and robot_existence[i+1] == 0 and belt[i+1]>=1: #로봇이 이동할 수 있는지 check
robot_existence[i+1] = 1
robot_existence[i] = 0
belt[i+1] -= 1 #내구도 1줄이기
robot_existence[-1] = 0 #로봇이 한칸씩 이동했으므로 0을 넣어줌으로서 로봇을 내린다.

if robot_existence[0] == 0 and belt[0]>=1: #로봇을 올리는 위치에 올려주는 역할
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 비슷한 방법으로 구현했어요! 잘 구현하셨네요 고생하셨습니다 😄

robot_existence[0] = 1
belt[0] -= 1 #내구도 1줄이기

result += 1
print(result)