feat: added alternative python solutions.

This commit is contained in:
2026-05-17 13:20:58 -03:00
parent 7e9caaea6e
commit c85571e157
451 changed files with 3777 additions and 3495 deletions

View File

@@ -0,0 +1,11 @@
N, W = map(int, input().split())
dp = [0] * (W + 1)
for _ in range(N):
w, v = map(int, input().split())
for j in range(W, w - 1, -1):
dp[j] = max(dp[j], dp[j - w] + v)
print(dp[W])

View File

@@ -6,7 +6,7 @@ using namespace std;
const int MIN_N = 1;
const int MAX_N = 100;
const int MIN_W = 1;
const int MAX_W = 1e5;
const int MAX_W = 1e4;
const int MIN_V = 1;
const int MAX_V = 1e9;

View File

@@ -8,7 +8,7 @@ int main(int argc, char* argv[]) {
registerValidation(argc, argv);
int N = inf.readInt(1, 100, "N");
inf.readSpace();
int W = inf.readInt(1, 1e5, "W");
int W = inf.readInt(1, 1e4, "W");
inf.readEoln();
for (int i = 0; i < N; i++) {
inf.readInt(1, W, "wi");