feat: added alternative python solutions.
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
},
|
||||
"solutions": {
|
||||
"main-ac": "ac.cpp",
|
||||
"alternative-ac": [],
|
||||
"alternative-ac": ["alternative-ac.py"],
|
||||
"wrong-answer": [],
|
||||
"time-limit": ["TLE.cpp"],
|
||||
"time-limit-or-ac": [],
|
||||
|
||||
15
subset-sum/src/alternative-ac.py
Normal file
15
subset-sum/src/alternative-ac.py
Normal file
@@ -0,0 +1,15 @@
|
||||
n, t = map(int, input().split())
|
||||
books = list(map(int, input().split()))
|
||||
|
||||
dp = [False] * (t + 1)
|
||||
dp[0] = True
|
||||
|
||||
for book in books:
|
||||
for i in range(t, book - 1, -1):
|
||||
if dp[i - book]:
|
||||
dp[i] = True
|
||||
|
||||
if dp[t]:
|
||||
print("PERFEITO!")
|
||||
else:
|
||||
print("IMPOSSIVEL!")
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user