第 1124 场 Codeforces Round(Div. 2)
A
香肠银行
SauSaGe Bank
Codeforces
800
原题
←B →

香肠银行AI (CI翻译)

Everyone in SauSaGe City is talking about its famous bank that offers a seemingly impossible deal:

SauSaGe 城的每个人都在谈论当地那家著名的银行,它推出了一项看似不可能兑现的承诺:AI (CI翻译)

"Leave your money with us, and we'll double it every single day!"

“把钱存到我们这里,我们每天都会让它翻倍!”AI (CI翻译)

Hamed decides to give it a try, so he deposits $1$ dollar into his account.

Hamed 决定试一试,于是向自己的账户存入了 $1$ 美元。AI (CI翻译)

Suppose that at the beginning of a day, his bank balance is $x$ dollars. Every day, the following events happen in order:

假设某天开始时,他的银行账户余额为 $x$ 美元。每天,以下事件会依次发生:AI (CI翻译)

  1. In the morning, the bank magically doubles his balance, so it becomes $2x$ dollars.
  2. At night, Hamed may choose to withdraw all of the money from his bank account. If he does, the withdrawn amount is added to his card, and his bank account is immediately reset to $1$ dollar so that the doubling process can begin again the next day. Otherwise, he leaves the money in the bank.
  1. 早上,银行会神奇地将他的余额翻倍,使其变为 $2x$ 美元。
  2. 晚上,Hamed 可以选择取出银行账户中的所有钱。如果他这样做,取出的钱会转入他的银行卡,而他的银行账户余额会立即重置为 $1$ 美元,以便第二天重新开始翻倍。否则,他会将钱留在银行里。
AI (CI翻译)

Unfortunately, this incredible bank will remain open for exactly $n$ days before shutting down forever.

遗憾的是,这家不可思议的银行只会再营业恰好 $n$ 天,随后便会永久关闭。AI (CI翻译)

Hamed wants to withdraw money on exactly $k$ different days before the bank closes. Determine the maximum amount of money that can be on Hamed's card after the $n$-th day.

Hamed 希望在银行关闭前,恰好在 $k$ 个不同的日子取款。请确定第 $n$ 天结束后,Hamed 的银行卡上最多能有多少钱。AI (CI翻译)

Input

输入格式

AI (CI翻译)

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

每组测试包含多个测试用例。第一行包含测试用例的数量 $t$($1 \le t \le 500$)。接下来是各个测试用例的描述。AI (CI翻译)

The only line of each test case contains the two integers $n$ and $k$ ($1\le k\le n\le30$).

每个测试用例仅有一行,包含两个整数 $n$ 和 $k$($1\le k\le n\le30$)。AI (CI翻译)

Output

输出格式

AI (CI翻译)

For each test case, print a single integer — the maximum amount of money that can be on Hamed's card after the $n$-th day.

对于每个测试用例,输出一个整数,表示第 $n$ 天结束后,Hamed 的银行卡上最多能有多少钱。AI (CI翻译)

Note

说明

AI (CI翻译)

In the first test case, his bank balance becomes $2$ on the first day, and he chooses to withdraw it.

在第一个测试用例中,他的银行账户余额在第 $1$ 天变为 $2$,他选择将其取出。AI (CI翻译)

In the second test case, he can withdraw his money on the $2$-nd day.

在第二个测试用例中,他可以在第 $2$ 天取款。AI (CI翻译)

In the third test case, he can withdraw his money on the $1$-st, $3$-rd, and $4$-th days. He receives $2$, $4$, and $2$, respectively.

在第三个测试用例中,他可以在第 $1$、$3$ 和 $4$ 天取款,分别获得 $2$、$4$ 和 $2$。AI (CI翻译)

样例

Input #1
5
1 1
2 1
4 3
5 5
10 2
Output #1
2
4
8
10
514
InputCopy OutputCopy
题目信息
题号
2269A
时间限制
1 s
内存限制
256 MB
标签
贪心
数学

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