-
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
[Recursion] bj17478- 재귀함수가 뭔가요? #4
Open
loveitall
wants to merge
4
commits into
main
Choose a base branch
from
recursion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 1051번 - 숫자 정사각형 | ||
# 각 꼭짓점의 합이 최대가 되는 정사각형을 찾는 문제 | ||
|
||
n, m = map(int, input().split()) | ||
|
||
arr = [] | ||
for _ in range(n) : | ||
arr.append(list(map(int, input()))) | ||
|
||
ans = 1 | ||
|
||
# 모든 좌표를 탐색한다 | ||
for i in range(n) : | ||
for j in range(m) : | ||
# 50미만까지 | ||
for k in range(1, 50): | ||
# 두 가지를 모두 충족할 때 | ||
if i + k < n and j + k < m : | ||
new = arr[i][j] | ||
|
||
if new == arr[i + k][j] and new == arr[i][j + k] and new == arr[i + k][j + k] : | ||
# n x m 최대값 크기 출력 | ||
ans = max(ans, (k + 1) ** 2) | ||
|
||
print(ans) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 17478번 - 재귀함수가 뭔가요? | ||
|
||
n = int(input()) | ||
|
||
def recursion(i, n) : | ||
print("____" * i + '"재귀함수가 뭔가요?"') | ||
if i == n : | ||
print("____" * i + '"재귀함수는 자기 자신을 호출하는 함수라네"') | ||
else : | ||
print("____" * i + '"잘 들어보게. 옛날옛날 한 산 꼭대기에 이세상 모든 지식을 통달한 선인이 있었어.') | ||
print("____" * i + '마을 사람들은 모두 그 선인에게 수많은 질문을 했고, 모두 지혜롭게 대답해 주었지.') | ||
print("____" * i + '그의 답은 대부분 옳았다고 하네. 그런데 어느 날, 그 선인에게 한 선비가 찾아와서 물었어."') | ||
recursion(i + 1, n) | ||
print("____" * i + "라고 답변하였지.") | ||
|
||
print("어느 한 컴퓨터공학과 학생이 유명한 교수님을 찾아가 물었다.") | ||
recursion(0, n) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
n 을 넘겨주니까 n에 대해서 전역변수로 n을 몰라도 되니까 좋은거 같네요 저도 매개변수로 넘겨주어야 겠습니다
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.
오.. 이게 나은 거구나~!