# BOJ - 5557 - 1학년

Updated:

```
import sys
def solution():
N = int(input())
arr = list(map(int, sys.stdin.readline().split()))
dp = [[0 for _ in range(21)] for _ in range(N-1)]
dp[0][arr[0]] += 1
for i in range(len(arr)-1):
for j in range(21):
data = dp[i-1][j]
if data:
if j - arr[i] > -1:
dp[i][j - arr[i]] += data
if j + arr[i] < 21:
dp[i][j + arr[i]] += data
print(dp[-1][arr[-1]])
solution()
```

https://www.acmicpc.net/problem/5557

## Leave a comment