Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TIL 2021年12月21日 first update BeackJoon/Sliber2/2529/박준규 #124

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

Open
Devjunku wants to merge 1 commit into main
base: main
Choose a base branch
Loading
from junku
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
Binary file added .DS_Store
View file Open in desktop
Binary file not shown.
Binary file added Baekjoon/.DS_Store
View file Open in desktop
Binary file not shown.
Binary file added Baekjoon/Silver2/.DS_Store
View file Open in desktop
Binary file not shown.
32 changes: 32 additions & 0 deletions Baekjoon/Silver2/2529/박준규.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
n = int(input())
op = input().split()
c = [False] * 10
mx, mn = "", ""

def possible(i, j, k):
if k == '<':
return i < j
if k == '>':
return i > j

# 어차피 크기 순서대로 dfs를 돌기 때문에 상관이 없음
def solve(cnt, s):
global mx, mn
if cnt == n + 1:
print(mn, mx)
if not len(mn):
mn = s
else:
mx = s
return
for i in range(10):
if not c[i]:
if cnt == 0 or possible(int(s[-1]), i , op[cnt - 1]):
c[i] = True
solve(cnt + 1, s + str(i))
c[i] = False


solve(0, "")
print(mx)
print(mn)

AltStyle によって変換されたページ (->オリジナル) /