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

[2023-08-18] sumin #113 #133

Merged
merged 2 commits into from
Aug 18, 2023
Merged

[2023-08-18] sumin #113 #133

merged 2 commits into from
Aug 18, 2023

Conversation

ksumini
Copy link
Contributor

@ksumini ksumini commented Aug 18, 2023

PR Summary

풀이시간: 25분

<input>

  • 1 ≤ N ≤ 15
  • 0 ≤ r, c < 2N

<solution>

  1. 함수의 정의
  • 2^n x 2^n 배열에서 (r,c)를 방문하는 순서를 반환하는 함수
  1. base condition
  • n = 0일 때, return 0
  1. 재귀식
  • (r,c)가 1번 사각형일 때, return go(n-1, r, c)
  • (r,c)가 2번 사각형일 때, return half*half + go(n-1, r, c-half)
  • (r,c)가 3번 사각형일 때, return 2halfhalf + go(n-1, r-half, c)
  • (r,c)가 4번 사각형일 때, return 3halfhalf + go(n-1, r-half, c-half)

@ksumini ksumini added the BOJ label Aug 18, 2023
@ksumini ksumini self-assigned this Aug 18, 2023
@ksumini ksumini linked an issue Aug 18, 2023 that may be closed by this pull request
- (r,c)가 4번 사각형일 때, return 3*half*half + go(n-1, r-half, c-half)

"""
def go(n, r, c):
Copy link
Member

Choose a reason for hiding this comment

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

Go가 뭔가 힘이나고 좋은 함수명인 것 같아서 웃고 갑니다 ㅎㅎ

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.

풀이가 유사하여 보기 편했습니다! 빠킹독 최고!!

2. base condition
- n = 0일 때, return 0

3. 재귀식
Copy link
Member

Choose a reason for hiding this comment

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

재귀식이 저랑 같은 것 같아요!! 수민님과 같은 식이 유도된 것 같아 성장한 기분이 듭니다 ㅎㅎ

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.

저는 재귀를 활용해서 푼 문제의 풀이를 설명할 때 어떻게 해야하나 항상 고민이 많았는데 역시 짬에서 나오는 간단 명료한 풀이 설명에 무릎을 탁! half라는 변수 명이 와닿아서 n번 사각형에 대한 점화식이 단 번에 이해가는 것 같습니다. 아래 코드 영역에서 n사분면 표기를 n번 사각형으로 표기해주신다면 완벽할 것 같습니다~

@ksumini
Copy link
Contributor Author

ksumini commented Aug 18, 2023

저는 재귀를 활용해서 푼 문제의 풀이를 설명할 때 어떻게 해야하나 항상 고민이 많았는데 역시 짬에서 나오는 간단 명료한 풀이 설명에 무릎을 탁! half라는 변수 명이 와닿아서 n번 사각형에 대한 점화식이 단 번에 이해가는 것 같습니다. 아래 코드 영역에서 n사분면 표기를 n번 사각형으로 표기해주신다면 완벽할 것 같습니다~

@zsmalla 헉 완전 이상하다고 생각을 못하고 있었어요! 반영해서 수정했습니다 :) 감사합니다 지수님👍👍👍

@ksumini ksumini merged commit 184f1c3 into main Aug 18, 2023
@ksumini ksumini deleted the sumin-#113 branch August 18, 2023 11:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BOJ] Z
3 participants