CF2269A.SauSaGe Bank
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Everyone in SauSaGe City is talking about its famous bank that offers a seemingly impossible deal:
"Leave your money with us, and we'll double it every single day!"
Hamed decides to give it a try, so he deposits 1 dollar into his account.
Suppose that at the beginning of a day, his bank balance is x dollars. Every day, the following events happen in order:
- In the morning, the bank magically doubles his balance, so it becomes 2x dollars.
- 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.
Unfortunately, this incredible bank will remain open for exactly n days before shutting down forever.
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.
萨乌萨格城的每个人都谈论着当地一家著名的银行,该银行提供了一项看似不可能的优惠:
“把钱存入我们银行,我们将每天为您翻倍!”
哈梅德决定尝试一下,于是他向自己的账户存入了 1 美元。
假设某天开始时,他的银行账户余额为 x 美元。每天将按以下顺序发生如下事件:
- 早晨,银行会神奇地将他的余额翻倍,使其变为 2x 美元;
- 晚上,哈梅德可选择从银行账户中全额取款。若他取款,则所取金额将加入他的银行卡余额,且其银行账户余额立即重置为 1 美元,以便第二天继续进行翻倍操作;否则,他将资金保留在银行账户中。
不幸的是,这家令人难以置信的银行将在恰好 n 天后永久关闭。
哈梅德希望在银行关闭前,恰好在 k 个不同的日子取款。请确定第 n 天结束后,哈梅德的银行卡上所能拥有的最大金额。
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤500). The description of the test cases follows.
The only line of each test case contains the two integers n and k (1≤k≤n≤30).
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤500)。随后是各测试用例的描述。
每个测试用例仅有一行,包含两个整数 n 和 k(1≤k≤n≤30)。
输出格式
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 卡上所能拥有的最多金额。
输入输出样例
输入#1
5 1 1 2 1 4 3 5 5 10 2
输出#1
2 4 8 10 514
说明/提示
In the first test case, his bank balance becomes 2 on the first day, and he chooses to withdraw it.
In the second test case, he can withdraw his money on the 2-nd day.
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.
在第一个测试用例中,他的银行余额在第一天变为 2,他选择在此日取款。
在第二个测试用例中,他可以在第 2 天取款。
在第三个测试用例中,他可以在第 1 天、第 3 天和第 4 天取款,分别获得 2、4 和 2。
输入解题思路,AI测评打分。不知道怎么写?