Algorithm/PS

[BOJ/백준] 5753 - Pascal Library [python]

chanwoong1 2023. 3. 16. 15:03
728x90

문제 링크

 

5753번: Pascal Library

Pascal University, one of the oldest in the country, needs to renovate its Library Building, because after all these centuries the building started to show the effects of supporting the weight of the enormous amount of books it houses. To help in the renov

www.acmicpc.net

문제 풀이

모든 케이스마다 참석한 사람이 한명이라도 존재할 때 "yes"를 출력하고, 아니라면 "no"를 출력해준다.

정답 코드

while True :
    lst = [*map(int, input().split())]
    if sum(lst) == 0 : break
    st = [0] * lst[0]
    for _ in range(lst[1]) :
        tmp = [*map(int, input().split())]
        for i in range(len(tmp)) :
            st[i] += tmp[i]
    if lst[1] in st : print("yes")
    else : print("no")
728x90