aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Semestr 4/aisd/Pracownia 2/gen.py24
-rwxr-xr-xSemestr 4/aisd/Pracownia 2/gen_test.sh24
-rw-r--r--Semestr 4/aisd/Pracownia 2/rozw4.cpp51
-rw-r--r--Semestr 4/aisd/rozw.cpp70
4 files changed, 0 insertions, 169 deletions
diff --git a/Semestr 4/aisd/Pracownia 2/gen.py b/Semestr 4/aisd/Pracownia 2/gen.py
deleted file mode 100644
index 13aed55..0000000
--- a/Semestr 4/aisd/Pracownia 2/gen.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from random import randint, seed
-import sys
-
-if (len(sys.argv) < 4):
- print("usage: python3 gen.py seed n sum")
- exit()
-
-seed(sys.argv[1])
-
-n, sum = map(int, sys.argv[2:4])
-if n > sum:
- print("N musi być mniejsze równe od sum.")
- exit()
-
-t = [1 for i in range(n)]
-
-for i in range(sum - n):
- idx = randint(0, n - 1)
- t[idx] += 1
-
-print(n)
-for i in t:
- print(i, end=' ')
-print()
diff --git a/Semestr 4/aisd/Pracownia 2/gen_test.sh b/Semestr 4/aisd/Pracownia 2/gen_test.sh
deleted file mode 100755
index d5bff05..0000000
--- a/Semestr 4/aisd/Pracownia 2/gen_test.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-mkdir -p tests
-cp gen.py tests/
-cd tests
-
-python3 gen.py 1 5 20 > t1.in
-python3 gen.py 2 10 100 > t2.in
-python3 gen.py 3 20 200 > t3.in
-python3 gen.py 4 40 600 > t4.in
-python3 gen.py 5 80 5000 > t5.in
-python3 gen.py 6 160 10000 > t6.in
-python3 gen.py 7 320 10000 > t7.in
-python3 gen.py 8 640 20000 > t8.in
-python3 gen.py 9 1280 20000 > t9.in
-python3 gen.py 10 2000 2000 > t10.in
-python3 gen.py 11 2000 20000 > t11.in
-python3 gen.py 12 2000 200000 > t12.in
-python3 gen.py 13 2000 1000000 > t13.in
-python3 gen.py 14 2000 1000000 > t14.in
-python3 gen.py 15 2000 1000000 > t15.in
-
-
-rm gen.py
diff --git a/Semestr 4/aisd/Pracownia 2/rozw4.cpp b/Semestr 4/aisd/Pracownia 2/rozw4.cpp
deleted file mode 100644
index 73ff79a..0000000
--- a/Semestr 4/aisd/Pracownia 2/rozw4.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include<bits/stdc++.h>
-using namespace std;
-
-const int MAX_SUM = 1e6, MAXN = 2004;
-int n;
-int dp[2][MAX_SUM + 10], H[MAXN];
-
-int main() {
- scanf("%d", &n);
- for (int i = 0; i < n; ++i) {
- scanf("%d", &H[i]);
- }
-
- sort(H, H + n);
-
- int sum = 0, K = 0;
- for (int i = 0; i < n; ++i) {
- int h = H[i];
- for (int i = 0; i <= min(sum, MAX_SUM); i++)
- dp[K^1][i] = dp[K][i];
-
- for (int i = 0; i <= min(sum, MAX_SUM); i++) {
- if (i != 0 && dp[K][i] == 0) continue;
-
- int left = abs(i - h), aux = i-h >= 0 ? 0 : h-i;
- if (left <= MAX_SUM) {
- dp[K^1][left] = max(dp[K^1][left], dp[K][i] + aux);
- }
- int right = i + h;
- if (right <= MAX_SUM) {
- dp[K^1][right] = max(dp[K^1][right], dp[K][i] + h);
- }
- }
-
- K ^= 1;
- sum += h;
- }
- if (dp[K][0] != 0) {
- printf("TAK\n%d\n", dp[K][0]);
- }
- else {
- int res = 0;
- for (int i = 1; i <= MAX_SUM; i++) {
- if (dp[K][i] != i && dp[K][i]) {
- res = i;
- break;
- }
- }
- printf("NIE\n%d\n", res);
- }
-} \ No newline at end of file
diff --git a/Semestr 4/aisd/rozw.cpp b/Semestr 4/aisd/rozw.cpp
deleted file mode 100644
index 0b5c3ba..0000000
--- a/Semestr 4/aisd/rozw.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#include<bits/stdc++.h>
-using namespace std;
-
-vector<int> v;
-
-int p(int n, int k, int m) {
- if (k == 0 && n != 0) return 0;
- if (k == 0 && n == 0) {
- for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
- cout << "\n";
- return 1;
- }
- int value = 0;
- for (int i = 0; i <= min(n, m); i++) {
- v.push_back(i);
- if (i == 25) {
- cout << "ELO\n";
- }
- value += p(n - i, k - 1, i);
- v.pop_back();
- }
- return value;
-}
-
-int tab[30][30];
-int cnt = 0;
-
-
-int d(int n, int k) {
- if (tab[n][k] != -1) return tab[n][k];
- cout << n << " " << k << " " << ++cnt << "\n";
- if (n == 0 && k == 0) return tab[n][k] = 1;
- if (k > n || k <= 0) if (k >= 0) return tab[n][k] = 0;
- return tab[n][k] = d(n-1, k-1) + d(n-k, k);
-}
-
-// int e(int n, int k) {
-// if (n == 0 && k == 0) return tab[n][k] = 1;
-// // if (n == 0 && k > 0) return tab[n][k] = 0;
-// if (n > 0 && k <= 0) {
-// if (k >= 0)
-// tab[n][k] = 0;
-// return 0;
-// }
-// if (n < 0) return 0;
-// if (tab[n][k] != -1) return tab[n][k];
-// return tab[n][k] = e(n, k-1) + e(n-k, k);
-// }
-// DP[i][j] = max(DP[i-1][j-1], DP[i-2][j], DP[i][j - 2], DP[i][j-2])
-
-int main() {
- int n, k;
- cin >> n >> k;
- for (int i = 0; i < 30; i++) {
- for (int j = 0; j < 30; j++)
- tab[i][j] = -1;
- }
- cout << d(n,k) << "\n";
- // cout << p(n, k, n) << "\n";
- // cout << e(n,k) << "\n";
-
- for (int i = 0; i < 26; i++) {
- cout << i << ": ";
- for (int j = 0; j < 6; j++) {
- cout << tab[i][j] << " ";
- }
- cout << "\n";
- }
- // cout << p(n, k, n) << "\n";
-} \ No newline at end of file