풀이 N = int(input()) arr = input() def dfs(index, total): global ans if index >= len(op): # 계산이 모두 끝난 경우 ans = max(ans, total) # ans 값과 최근 total 값 비교해서 ans 최신화 return # 메소드 종료 now = calc(total, num_arr[index+1], op[index]) # 현재 index의 연산 진행 dfs(index+1, now) # 다음 index의 연산으로 넘어간다. if index+1 < len(op): tp = calc(num_arr[index+1], num_arr[index+2], op[index+1]) # 다음 index의 연산 진행 now = calc(total, tp, op[index]) dfs(index+2, now) # 다음 index의 연산까지 진행했으니 다다음으로 넘어간다. # 연산 메소드 def calc(a, b, oper): if ...
#
16637파이썬
#
dfs
#
깊이우선탐색
#
백준16637
#
백준16637파이썬