Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- const int SZ = 1e5 + 5, INF = 1e9;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- int n, t, ans = 0;
- vector<int> a;
- cin >> t;
- for (int i = 0; i < t; i++) {
- cin >> n;
- int cnt = 0;
- a.resize(n);
- set<int> s;
- s.clear();
- for (int i = 0; i < n; i++) {
- cin >> a[i];
- if (a[i] % 2 == 0) {
- s.insert(a[i]);
- }
- }
- while (!s.empty()) {
- int x = *s.rbegin();
- s.erase(x);
- x /= 2;
- if (x % 2 == 0) s.insert(x);
- cnt++;
- /*for (auto it : s) {
- cout << it << " ";
- }*/
- }
- cout << cnt << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement