We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3902c53 commit 2c30414Copy full SHA for 2c30414
1 file changed
이티예원/1431_시리얼 번호.py
@@ -0,0 +1,20 @@
1
+import sys
2
+
3
+n = int(sys.stdin.readline())
4
5
+guitar = []
6
7
+for _ in range(n):
8
+ guitar.append(sys.stdin.readline().strip())
9
10
+def serialSum(str):
11
+ sum = 0
12
+ for i in str:
13
+ if i.isdigit():
14
+ sum += int(i)
15
+ return sum
16
17
+guitar.sort(key = lambda x : (len(x), serialSum(x), x))
18
19
+for a in guitar:
20
+ print(a)
0 commit comments