CF1296B.Food Buying
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mishka wants to buy some food in the nearby shop. Initially, he has s burles on his card.
Mishka can perform the following operation any number of times (possibly, zero): choose some positive integer number 1≤x≤s, buy food that costs exactly x burles and obtain ⌊10x⌋ burles as a cashback (in other words, Mishka spends x burles and obtains ⌊10x⌋ back). The operation ⌊ba⌋ means a divided by b rounded down.
It is guaranteed that you can always buy some food that costs x for any possible value of x.
Your task is to say the maximum number of burles Mishka can spend if he buys food optimally.
For example, if Mishka has s=19 burles then the maximum number of burles he can spend is 21. Firstly, he can spend x=10 burles, obtain 1 burle as a cashback. Now he has s=10 burles, so can spend x=10 burles, obtain 1 burle as a cashback and spend it too.
You have to answer t independent test cases.
米什卡想在附近的商店购买一些食物。最初,他的卡上有 s 卢布。
米什卡可以执行以下操作任意多次(也可以不执行):选择某个正整数 1≤x≤s,购买恰好花费 x 卢布的食物,并获得 ⌊10x⌋ 卢布的返现(即:米什卡支出 x 卢布,并返还 ⌊10x⌋ 卢布)。其中运算 ⌊ba⌋ 表示 a 除以 b 后向下取整。
题目保证:对任意可能的 x 值,总存在价格恰好为 x 卢布的食物可供购买。
你的任务是求出:若米什卡以最优策略购物,他最多能总共花费多少卢布。
例如,若米什卡初始有 s=19 卢布,则他最多可花费 21 卢布。具体过程如下:首先花费 x=10 卢布,获得 1 卢布返现;此时他剩余 10 卢布(原 19−10+1=10),再花费 x=10 卢布,又获得 1 卢布返现,最后将这 1 卢布也花掉。
你需要回答 t 个相互独立的测试用例。
输入格式
The first line of the input contains one integer t (1≤t≤104) — the number of test cases.
The next t lines describe test cases. Each test case is given on a separate line and consists of one integer s (1≤s≤109) — the number of burles Mishka initially has.
输入的第一行包含一个整数 t(1≤t≤104)—— 表示测试用例的数量。
接下来的 t 行描述了各个测试用例。每个测试用例占单独一行,包含一个整数 s(1≤s≤109)—— 表示 Mishka 最初拥有的 burles 数量。
输出格式
For each test case print the answer on it — the maximum number of burles Mishka can spend if he buys food optimally.
对于每个测试用例,输出对应的答案——即 Mishka 在最优购买食物策略下最多可以花费的 burles 数量。
输入输出样例
输入#1
6 1 10 19 9876 12345 1000000000
输出#1
1 11 21 10973 13716 1111111111
输入解题思路,AI测评打分。不知道怎么写?