-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[장희직] - 왕실의 기사 대결, 메이즈 러너, 귤 고르기, 아이템 줍기 #238
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
def solution(k, tangerines): | ||
limit = k | ||
|
||
tan_cnt = defaultdict(int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파이썬이 진짜 좋네요
for tangerine in tangerines: | ||
tan_cnt[tangerine] += 1 | ||
sorted_tan_cnt = sorted(tan_cnt.values(), reverse=True) | ||
for idx, tan_cnt in enumerate(sorted_tan_cnt): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enumerate 안쓰면 안되는건가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 알기론 enumerate 써야 index 같이 추출하는 걸로 알고 있어요!
|
||
|
||
def move(origin_number, number, d): | ||
print("number:", number, "origin_number:", origin_number, "d:", d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 이거 남겨도 혹시 정답처리가 되나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아닙니다 ㅠㅠ 제출할 땐 제거했었어요 ㅠ
ny = y + dy[d] | ||
if board_pos[nx][ny] != -1 and board_pos[nx][ny] != number: | ||
new_number.append(board_pos[nx][ny]) | ||
for n_number in set(new_number): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요러면 요 포문에서 순회할 때 new_number가 리스트가 아닌 셋처럼 동작하는건가요???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옙!!👍
|
||
|
||
def solution(_rectangle, character_x, character_y, item_x, item_y): | ||
rectangle = map(lambda x: list(map(lambda y: y * 2, x)), _rectangle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호...
offset_x = x1 | ||
offset_y = y1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오프셋 처리를 저도 해봐야겠네요
for tangerine in tangerines: | ||
tan_cnt[tangerine] += 1 | ||
sorted_tan_cnt = sorted(tan_cnt.values(), reverse=True) | ||
for idx, tan_cnt in enumerate(sorted_tan_cnt): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enumerate로 idx쓰는게 깔끔하네요!
moved_pos = [] | ||
|
||
|
||
def move(origin_number, number, d): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왜인지는 모르겠지만 dfs로 풀면 힘들겠다고 생각했는데, dfs로도 잘 푸는 방법을 보게 되어 좋았습니다!
|
||
|
||
def solution(_rectangle, character_x, character_y, item_x, item_y): | ||
rectangle = map(lambda x: list(map(lambda y: y * 2, x)), _rectangle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
덕분에 어떻게 풀어야하는지를 깨닫게 되었어요!
return answer | ||
|
||
|
||
def bfs(character_x, character_y, item_x, item_y): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그냥 bfs로 탐색해도 갈 수가 있군요.....
📌 from issue #234 📌
📋문제 목록📋