Skip to content

Commit e227274

Browse files
author
hangyeol
committed
98차 2번 문제풀이
1 parent aeafd0c commit e227274

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

live9/test98/문제2/백한결.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from itertools import permutations
2+
3+
def main():
4+
x = str(input().strip())
5+
6+
# 모든 순열 생성
7+
perm = set(permutations(x))
8+
9+
# 가능한 후보 중 x보다 큰 수
10+
candidates = []
11+
for p in perm:
12+
numStr = ''.join(p)
13+
num = int(numStr)
14+
if num > int(x):
15+
candidates.append(num)
16+
17+
if candidates:
18+
print(min(candidates))
19+
else:
20+
print(0)
21+
22+
if __name__ == "__main__":
23+
main()

0 commit comments

Comments
 (0)