aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/aisd/Pracownia 1/rozw2.cpp
diff options
context:
space:
mode:
authorFranciszek Malinka <franciszek.malinka@gmail.com>2021-03-30 20:00:11 +0200
committerFranciszek Malinka <franciszek.malinka@gmail.com>2021-03-30 20:00:11 +0200
commit3ece8214fbf6389d0fabb63a9040720757c7db71 (patch)
tree14d58d391aa7504c450dd704a2ffbcf3499a0621 /Semestr 4/aisd/Pracownia 1/rozw2.cpp
parente18c47449761598ab0d4e50979f99f4858bc4c08 (diff)
zmiana nazw
Diffstat (limited to 'Semestr 4/aisd/Pracownia 1/rozw2.cpp')
-rw-r--r--Semestr 4/aisd/Pracownia 1/rozw2.cpp33
1 files changed, 0 insertions, 33 deletions
diff --git a/Semestr 4/aisd/Pracownia 1/rozw2.cpp b/Semestr 4/aisd/Pracownia 1/rozw2.cpp
deleted file mode 100644
index 35fd37e..0000000
--- a/Semestr 4/aisd/Pracownia 1/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