fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int f(int x) {
  5. int cnt = 0;
  6. while(x) {
  7. cnt++;
  8. x /= 2;
  9. }
  10. return cnt;
  11. }
  12. signed main() {
  13. int t; cin >> t;
  14. while(t--) {
  15. int x, N, M; cin >> x >> N >> M;
  16.  
  17. int min = x, n = N, m = M;
  18. while (min > 1 && m) {
  19. min = min + 1 >> 1;
  20. m--;
  21. }
  22. while (min && n) {
  23. min >>= 1;
  24. n--;
  25. }
  26. int max = x;
  27. n = N, m = M;
  28. while (max && n) {
  29. max >>= 1;
  30. n--;
  31. }
  32. while (max > 1 && m) {
  33. max = max + 1 >> 1;
  34. m--;
  35. }
  36. cout << min << ' ' << max << '\n';
  37. }
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0.01s 5268KB
stdin
5
12 1 2
12 1 1
12 0 0
12 1000000000 1000000000
706636307 0 3
stdout
1 2
3 3
12 12
0 0
88329539 88329539