Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6.  
  7. const int SZ = 1e5 + 5, INF = 1e9;
  8.  
  9. int main() {
  10. ios_base::sync_with_stdio(false);
  11. cin.tie(0);
  12. cout.tie(0);
  13. int n, t, ans = 0;
  14. vector<int> a;
  15. cin >> t;
  16. for (int i = 0; i < t; i++) {
  17. cin >> n;
  18. int cnt = 0;
  19. a.resize(n);
  20. set<int> s;
  21. s.clear();
  22. for (int i = 0; i < n; i++) {
  23. cin >> a[i];
  24. if (a[i] % 2 == 0) {
  25. s.insert(a[i]);
  26. }
  27. }
  28. while (!s.empty()) {
  29. int x = *s.rbegin();
  30. s.erase(x);
  31. x /= 2;
  32. if (x % 2 == 0) s.insert(x);
  33. cnt++;
  34. /*for (auto it : s) {
  35. cout << it << " ";
  36. }*/
  37. }
  38. cout << cnt << '\n';
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement