Advertisement
Egor_1425

Untitled

Apr 4th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. n, m = map(int, input().split())
  2. a = list(map(int, input().split()))
  3.  
  4. dp = [0] * 10000
  5. dp[0] = 1
  6.  
  7. for i in a:
  8.     for j in range(m, -1, -1):
  9.         if dp[j] == 1:
  10.             dp[j + i] = 1
  11.  
  12. if dp[m] == 1:
  13.     print('YES')
  14. else:
  15.     print('NO')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement