코딩테스트대비/탐색 & 시물레이션

사과나무

포비용 2023. 3. 25.
import sys
import math

sys.stdin = open("input.txt","rt")

n = int(input())
lists = [list(map(int, input().split())) for i in range(n)]

st_point = lists[0][math.floor(n/2)]
first_ind = math.floor(n/2)

for i in range(1,first_ind+1):

    lt_point = first_ind - i
    rt_point = first_ind + i + 1
    st_point += sum(lists[i][lt_point:rt_point])


x = 0
for k in range(i+1, n):
    x += 1

    first_ind = x
    last_ind = -x

    st_point += sum(lists[k][first_ind:last_ind])


print(st_point)

'코딩테스트대비 > 탐색 & 시물레이션' 카테고리의 다른 글

봉우리  (0) 2023.03.28
곳감  (0) 2023.03.26
수들의 합(다시 풀기)  (0) 2023.01.28
두 리스트 합치기  (0) 2023.01.27
카드역배치  (0) 2023.01.27

댓글