diff options
Diffstat (limited to 'Semestr 4/aisd/Pracownia 1/rozw2.cpp')
-rw-r--r-- | Semestr 4/aisd/Pracownia 1/rozw2.cpp | 33 |
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 |