Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define pb push_back
  4. #define eb emplace_back
  5. //#define A0(x) x,
  6. //#define A1(x) A0(x) A0(x + 1) A0(x + 3) A0(x + 4)
  7. //#define A2(x) A1(x) A1(x + 1) A1(x + 3) A1(x + 4)
  8. //#define A3(x) A2(x) A2(x + 1) A2(x + 3) A2(x + 4)
  9.  
  10. using namespace std;
  11.  
  12. //const long long values[1000] = { A3(0) };
  13.  
  14. int main() {
  15. ios_base::sync_with_stdio(0);
  16. cin.tie(0);
  17. ll n;
  18. cin >> n;
  19. vector<ll>mas{0, 1, 3, 4};
  20. for(auto i = 0; i < n; i++){
  21. ll pos, ans = 0;
  22. cin >> pos;
  23. while(pos > 0){
  24. ans += mas[pos % 4];
  25. pos = pos / 4;
  26. }
  27. cout << ans << "\n";
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement