Codeforces Round 1010 (Div. 2, Unrated)
B
Floor or Ceil
Codeforces
1600
原题
← AC →
翻译中…

Ecrade has an integer $x$. There are two kinds of operations.

翻译中…
  1. Replace $x$ with $\left\lfloor \dfrac{x}{2}\right\rfloor$, where $\left\lfloor \dfrac{x}{2}\right\rfloor$ is the greatest integer $\le \dfrac{x}{2}$.
  2. Replace $x$ with $\left\lceil \dfrac{x}{2}\right\rceil$, where $\left\lceil \dfrac{x}{2}\right\rceil$ is the smallest integer $\ge \dfrac{x}{2}$.
翻译中…

Ecrade will perform exactly $n$ first operations and $m$ second operations in any order. He wants to know the minimum and the maximum possible value of $x$ after $n+m$ operations. However, it seems a little difficult, so please help him!

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The only line of each test case contains three integers $x$, $n$, and $m$ ($0 \le x, n, m \le 10^9$).

翻译中…

Output

翻译中…

For each test case, print two integers in one line, representing the minimum and the maximum possible value of $x$ after $n + m$ operations.

翻译中…

Note

翻译中…

For simplicity, we call the first operation $\text{OPER 1}$ and the second operation $\text{OPER 2}$.

翻译中…

In the first test case:

翻译中…
  • If we perform $12 \xrightarrow{\text{OPER 2}} 6 \xrightarrow{\text{OPER 2}} 3 \xrightarrow{\text{OPER 1}} 1$, we can obtain the minimum possible value $1$.
  • If we perform $12 \xrightarrow{\text{OPER 2}} 6 \xrightarrow{\text{OPER 1}} 3 \xrightarrow{\text{OPER 2}} 2$, we can obtain the maximum possible value $2$.
翻译中…

样例

Input #1
5
12 1 2
12 1 1
12 0 0
12 1000000000 1000000000
706636307 0 3
Output #1
1 2
3 3
12 12
0 0
88329539 88329539
InputCopy OutputCopy
题目信息
题号
2082B
时间限制
1 s
内存限制
512 MB
标签
暴力
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。