[백준 2890][Python] 카약

봉글렛·2023년 1월 7일

백준

목록 보기
27/55

문제 링크 https://www.acmicpc.net/problem/2890

순위를 잘 선택해야함.

풀이

import re
le = [-1 for _ in range(9)]
r, c = map(int, input().split())

for _ in range(r):
idx = re.split('[1-9]{2}', input())
if idx[0].count('.') != (c - 2):
le[int(idx[1][0])-1] = ((c-5) - idx[0].count('.'))

d = {}
rank = 1
for num in sorted(le):
if num not in d:
d[num] = rank
rank += 1
result = [d[i] for i in le]
for i in result:
print(i)

profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글