ji-0630 / CodingTest

코딩테스트 연습 기록
0 stars 0 forks source link

0 채우기 #273

Closed ji-0630 closed 1 year ago

ji-0630 commented 1 year ago

문제 설명

image

ji-0630 commented 1 year ago

나의 풀이

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
import sys
n = int(input())

lst = []
for i in range(n):
    lst.append(list(map(int, sys.stdin.readline().split())))

s = 0
k = 0
for i in range(n):
    for j in range(n):
        if lst[i][j] == 0:
            s += sum(lst[i])
            k = j

for i in range(n):
    s += lst[i][k]
print(s)