Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

[2023-09-06] sumin #181 #196

Merged
merged 3 commits into from
Sep 7, 2023
Merged

[2023-09-06] sumin #181 #196

merged 3 commits into from
Sep 7, 2023

Conversation

ksumini
Copy link
Contributor

@ksumini ksumini commented Sep 6, 2023

PR Summary

풀이시간: 10분

<input>
진법 n, 미리 구할 숫자의 갯수 t, 게임에 참가하는 인원 m, 튜브의 순서 p 가 주어진다.

  • n: 진법 (2 ≦ n ≦ 16)
  • t: 미리 구할 숫자의 갯수 (0 < t ≦ 1000)
  • m: 게임에 참가하는 인원 (2 ≦ m ≦ 100)
  • p: 튜브의 순서 (1 ≦ p ≦ m)

<solution>

  1. 변환한 숫자를 모두 합친 문자열의 길이가 t * m가 될 때까지 순서대로 숫자를 n진수로 변환해 추가해준다.
  2. 문자열을 순회하며 튜브의 순서가 되는 문자열을 ans에 추가한다.

<시간복잡도>
O(t*m)

@ksumini ksumini self-assigned this Sep 6, 2023
@ksumini ksumini linked an issue Sep 6, 2023 that may be closed by this pull request
Copy link
Member

@Woo-Yeol Woo-Yeol left a comment

Choose a reason for hiding this comment

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

재귀를 통해서 N진수를 구하신게 신기했습니다! 지수님 리뷰에 궁금한 점을 달았었는데 수민님 풀이를 보면서 또 해소가 된 것 같아 다행입니다! 고생하셨어요 수민님!

Copy link
Contributor

@zsmalla zsmalla left a comment

Choose a reason for hiding this comment

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

n진수 변환 로직을 재귀를 활용해 순서대로 값을 배치한 부분이 너무 재미있었던 것 같습니다. 앞으로 종종 이렇게도 활용해봐야겠어요! 고생하셨습니다 수민님!

while len(tmp) < t * m:
tmp += convert(i, n)
i += 1
for i in range(p-1, t*m, m): # 튜브의 차례에 해당하는 숫자 answer에 추가
Copy link
Contributor

Choose a reason for hiding this comment

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

이 라인에서 range 자체가 답을 가진 리스트를 반환하니 이를 활용하셨어도 좋았을 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

지수님이 말씀하신 내용으로 다시 수정해서 commit 했습니당 😆 감사합니다 :)

Copy link
Contributor

@limstonestone limstonestone left a comment

Choose a reason for hiding this comment

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

문제에 맞춰서 진수도 재귀로 풀어내고 깔끔한 반복문과 슬라이싱까지 지렸씁니다!!!!

@ksumini ksumini merged commit 7cd7f2b into main Sep 7, 2023
@ksumini ksumini deleted the sumin-#181 branch September 7, 2023 10:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Programmers] n진수 게임
4 participants