aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/aisd/pracownia1
diff options
context:
space:
mode:
authorFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
committerFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
commitc5fcf7179a83ef65c86c6a4a390029149e518649 (patch)
treed29ffc5b86a0d257453cedcf87d91a13d8bf3b0d /Semestr 4/aisd/pracownia1
parentf8a88b6a4aba1f66d04711a9330eaba49a50c463 (diff)
Duzy commit ze smieciami
Diffstat (limited to 'Semestr 4/aisd/pracownia1')
-rw-r--r--Semestr 4/aisd/pracownia1/pracownia1.pdfbin55846 -> 0 bytes
-rw-r--r--Semestr 4/aisd/pracownia1/rozw.cpp59
-rw-r--r--Semestr 4/aisd/pracownia1/rozw2.cpp33
3 files changed, 0 insertions, 92 deletions
diff --git a/Semestr 4/aisd/pracownia1/pracownia1.pdf b/Semestr 4/aisd/pracownia1/pracownia1.pdf
deleted file mode 100644
index 2b99ba4..0000000
--- a/Semestr 4/aisd/pracownia1/pracownia1.pdf
+++ /dev/null
Binary files differ
diff --git a/Semestr 4/aisd/pracownia1/rozw.cpp b/Semestr 4/aisd/pracownia1/rozw.cpp
deleted file mode 100644
index acbd711..0000000
--- a/Semestr 4/aisd/pracownia1/rozw.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include<bits/stdc++.h>
-using namespace std;
-typedef long long ll;
-
-vector<pair<int, pair<int, int>>> v;
-const int MAX_LEN = 85;
-int bits[100];
-
-int main() {
- ios_base::sync_with_stdio(false);
- cin.tie();
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int d, nd;
- cin >> d >> nd;
- int k = 0;
- while (d % 2 == 0) {
- d /= 2;
- k++;
- }
- v.push_back({d, {k, nd}});
- }
- sort(v.begin(), v.end());
- int result = 0;
-
- for (int i = 0; i < n; ) {
- int h = i;
- int d = v[i].first;
- while (h < n && v[h].first == d) {
- h++;
- }
- for (int k = 0; k < MAX_LEN; k++)
- bits[k] = 0;
- for (int j = i; j < h; ++j) {
- ll x = (ll)(1LL << v[j].second.first) * (ll)v[j].second.second;
- int k = 0;
- while (x > 0) {
- if (x % 2 == 1) {
- bits[k]++;
- }
- x /= 2;
- k++;
- }
- }
-
- for (int k = 0; k < MAX_LEN; k++) {
- if (bits[k] > 1) {
- bits[k + 1] += bits[k]/2;
- }
- if (bits[k] % 2 == 1) {
- result++;
- }
- }
- i = h;
- }
-
- cout << result << "\n";
-} \ No newline at end of file
diff --git a/Semestr 4/aisd/pracownia1/rozw2.cpp b/Semestr 4/aisd/pracownia1/rozw2.cpp
deleted file mode 100644
index 35fd37e..0000000
--- a/Semestr 4/aisd/pracownia1/rozw2.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include<bits/stdc++.h>
-using namespace std;
-typedef unsigned long long ll;
-
-vector<pair<int, ll>> v;
-
-int main() {
- int n;
- scanf("%d", &n);
- for (int i = 0; i < n; i++) {
- int d, nd, k = 0;
- scanf("%d %d", &d, &nd);
- while (d % 2 == 0) {
- k++;
- d /= 2;
- }
- v.push_back({d, (ll)(1LL<<k) * (ll)nd});
- }
- sort(v.begin(), v.end());
- int result = 0;
- for (int i = 0; i < n; ) {
- int j = i;
- int cur = v[i].first;
- ll count = 0;
- while (j < n && v[j].first == cur) {
- count += v[j].second;
- ++j;
- }
- result += __builtin_popcountll(count);
- i = j;
- }
- cout << result << "\n";
-} \ No newline at end of file