Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define pb push_back
- #define eb emplace_back
- //#define A0(x) x,
- //#define A1(x) A0(x) A0(x + 1) A0(x + 3) A0(x + 4)
- //#define A2(x) A1(x) A1(x + 1) A1(x + 3) A1(x + 4)
- //#define A3(x) A2(x) A2(x + 1) A2(x + 3) A2(x + 4)
- using namespace std;
- //const long long values[1000] = { A3(0) };
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- ll n;
- cin >> n;
- vector<ll>mas{0, 1, 3, 4};
- for(auto i = 0; i < n; i++){
- ll pos, ans = 0;
- cin >> pos;
- while(pos > 0){
- ans += mas[pos % 4];
- pos = pos / 4;
- }
- cout << ans << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement