We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aeafd0c commit e227274Copy full SHA for e227274
1 file changed
live9/test98/문제2/백한결.py
@@ -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