Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define LL long long
  4.  
  5. const LL M = 1e9+7;
  6.  
  7. LL f(LL x, LL bit)
  8. {
  9. x++;
  10. LL period = 1LL<<(bit+1);
  11. LL a = ((period/2)%M)*((x/period)%M);
  12. LL b = x%period - period/2;
  13. if (b>0) a=(a+b)%M;
  14. return a;
  15. }
  16.  
  17. int main()
  18. {
  19. int t;
  20. cin>>t;
  21. while (t--)
  22. {
  23. int l, r;
  24. cin>>l>>r;
  25. if (l>r) swap(l,r);
  26. LL ans = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement