Closed ji-0630 closed 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)
문제 설명