CF1296B.Food Buying

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Mishka wants to buy some food in the nearby shop. Initially, he has ss burles on his card.

Mishka can perform the following operation any number of times (possibly, zero): choose some positive integer number 1≤x≤s1 \le x \le s, buy food that costs exactly xx burles and obtain ⌊x10⌋\lfloor\frac{x}{10}\rfloor burles as a cashback (in other words, Mishka spends xx burles and obtains ⌊x10⌋\lfloor\frac{x}{10}\rfloor back). The operation ⌊ab⌋\lfloor\frac{a}{b}\rfloor means aa divided by bb rounded down.

It is guaranteed that you can always buy some food that costs xx for any possible value of xx.

Your task is to say the maximum number of burles Mishka can spend if he buys food optimally.

For example, if Mishka has s=19s=19 burles then the maximum number of burles he can spend is 2121. Firstly, he can spend x=10x=10 burles, obtain 11 burle as a cashback. Now he has s=10s=10 burles, so can spend x=10x=10 burles, obtain 11 burle as a cashback and spend it too.

You have to answer tt independent test cases.

米什卡想在附近的商店购买一些食物。最初,他的卡上有 ss 卢布。

米什卡可以执行以下操作任意多次(也可以不执行):选择某个正整数 1≤x≤s1 \le x \le s,购买恰好花费 xx 卢布的食物,并获得 ⌊x10⌋\lfloor\frac{x}{10}\rfloor 卢布的返现(即:米什卡支出 xx 卢布,并返还 ⌊x10⌋\lfloor\frac{x}{10}\rfloor 卢布)。其中运算 ⌊ab⌋\lfloor\frac{a}{b}\rfloor 表示 aa 除以 bb 后向下取整。

题目保证:对任意可能的 xx 值,总存在价格恰好为 xx 卢布的食物可供购买。

你的任务是求出:若米什卡以最优策略购物,他最多能总共花费多少卢布。

例如,若米什卡初始有 s=19s=19 卢布,则他最多可花费 2121 卢布。具体过程如下:首先花费 x=10x=10 卢布,获得 11 卢布返现;此时他剩余 1010 卢布(原 19−10+1=1019-10+1=10),再花费 x=10x=10 卢布,又获得 11 卢布返现,最后将这 11 卢布也花掉。

你需要回答 tt 个相互独立的测试用例。

输入格式

The first line of the input contains one integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases.

The next tt lines describe test cases. Each test case is given on a separate line and consists of one integer ss (1≤s≤1091 \le s \le 10^9) — the number of burles Mishka initially has.

输入的第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4)—— 表示测试用例的数量。

接下来的 tt 行描述了各个测试用例。每个测试用例占单独一行,包含一个整数 ss(1≤s≤1091 \le s \le 10^9)—— 表示 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测评打分。不知道怎么写?

首页