[백준] #1431 시리얼 번호 python
2023. 5. 24. 10:37
https://www.acmicpc.net/problem/1431
📕 설명 📕
숫자와 문자에 대해서 값을 계산하고 그 값에 대해서 정렬을 수행했다.
🧑🏻💻 나의 풀이 🧑🏻💻
N = int(input())
li = []
for _ in range(N):
S = input()
count = 0
for s in S:
if 48 <= ord(s) <= 57:
count += int(s)
li.append([S, count])
li = sorted(li, key=lambda x: (len(x[0]), x[1], x[0]))
#print(li)
for i in range(N):
print(li[i][0])
'Programming > Algorithm' 카테고리의 다른 글
[백준] #1240 노드사이의 거리 python (0) | 2023.05.26 |
---|---|
[백준] #1972 놀라운 문자열 python (0) | 2023.05.25 |
[백준] #1235 학생 번호 python (0) | 2023.05.23 |
[백준] #1251 단어 나누기 python (0) | 2023.05.22 |
[백준] #2630 색종이 만들기 python (0) | 2023.05.19 |