Saleh127

codeforces 1362C.cpp

Jun 4th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define Faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. Faster
  9. test
  10. {
  11. ll n,ans;
  12. cin>>n;
  13. ans=n;
  14. while(n>=1)
  15. {
  16. ans+=(n/2);
  17. n=n/2;
  18. }
  19. cout<<ans<<endl;
  20. }
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment