파이썬/알고리즘 (파이썬)백준 알고리즘 1932번 숫자삼각형 오지고지리고알파고포켓몬고 2017. 5. 29. 14:47 백준 알고리즘 저지 1932번 문제 (https://www.acmicpc.net/problem/1932) a=[] for i in range(int(input())): if i==0:a.append(int(input())) elif i==1: aa,bb=list(map(int,input().split())) a.append([aa+a[i-1],bb+a[i-1]]) else: temp=list(map(int,input().split())) a.append([]) c = 0 for j in temp: if c==0: a[i].append( a[i-1][0]+j ) elif c==len(temp)-1: a[i].append( a[i-1][-1]+j ) else: if a[i-1][c-1]+j>a[i-1][c]+j:a[i].append(a[i-1][c-1]+j) else:a[i].append(a[i-1][c]+j) c+=1 print(max(a[-1])) 저작자표시 비영리 변경금지