본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 5602번 問題1

by 현장 2023. 5. 30.

-Code

n, m = map(int, input().split())

travel = [0] * m
res = []

for _ in range(n):
    students = list(map(int, input().split()))

    for i in range(m):
        if students[i] == 1:
            travel[i] += 1

for i in range(max(travel), -1, -1):
    for j in range(m):
        if i == travel[j]:
            res.append(j + 1)
print(*res)