日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Food Buying(CF-1296B)

發(fā)布時間:2025/3/17 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Food Buying(CF-1296B) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Problem Description

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 ?x10? burles as a cashback (in other words, Mishka spends x burles and obtains ?x10? back). The operation ?ab? 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.

Input

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.

Output

For each test case print the answer on it — the maximum number of burles Mishka can spend if he buys food optimally.

Examples

Input

6
1
10
19
9876
12345
1000000000

Output

1
11
21
10973
13716
1111111111

題意:t 組數(shù)據(jù),每組給出 1 個數(shù) n,代表有 n 元錢,現(xiàn)在用這 n 元錢買東西,每買 10 元返現(xiàn) 1 元,不足 10 元不進行返現(xiàn),在返現(xiàn)后,將剩下的錢與返現(xiàn)的錢相加,繼續(xù)買東西,重復返現(xiàn)過程,問最終能買多少錢的東西

思路:照題意模擬即可

Source Program

#include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<cmath> #include<ctime> #include<algorithm> #include<utility> #include<stack> #include<queue> #include<vector> #include<set> #include<map> #include<bitset> #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long #define Pair pair<int,int> LL quickPow(LL a,LL b){ LL res=1; while(b){if(b&1)res*=a; a*=a; b>>=1;} return res; } LL multMod(LL a,LL b,LL mod){ a%=mod; b%=mod; LL res=0; while(b){if(b&1)res=(res+a)%mod; a=(a<<=1)%mod; b>>=1; } return res%mod;} LL quickMultPowMod(LL a, LL b,LL mod){ LL res=1,k=a; while(b){if((b&1))res=multMod(res,k,mod)%mod; k=multMod(k,k,mod)%mod; b>>=1;} return res%mod;} LL quickPowMod(LL a,LL b,LL mod){ LL res=1; while(b){if(b&1)res=(a*res)%mod; a=(a*a)%mod; b>>=1; } return res; } LL getInv(LL a,LL mod){ return quickPowMod(a,mod-2,mod); } LL GCD(LL x,LL y){ return !y?x:GCD(y,x%y); } LL LCM(LL x,LL y){ return x/GCD(x,y)*y; } const double EPS = 1E-15; const int MOD = 1000000000+7; const int N = 2000+5; const int dx[] = {0,0,1,-1,1,1,-1,-1}; const int dy[] = {1,-1,0,0,1,-1,1,-1}; using namespace std;int main() {int t;scanf("%d", &t);while (t--) {LL n;scanf("%lld", &n);LL res = 0;while (n >= 0) {LL k = floor(n / 10);res += k * 10;n -= k * 10;n += k;if (n <= 9) {res += n;break;}}printf("%lld\n", res);}}

?

總結

以上是生活随笔為你收集整理的Food Buying(CF-1296B)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日本一区二区三区四区在线观看 | 日本一区二区不卡在线观看 | 亚洲电影中文字幕 | 免费av不卡 | 99免费在线| 丝袜 亚洲 另类 国产 制服 | 成人福利片 | 免费看黄色一级大片 | www.国产视频 | 日本在线观看免费 | 妇女一级片 | 亚洲区成人| 天天曰天天操 | 夜夜嗨av禁果av粉嫩av懂色av | 国产日韩在线观看一区 | 97精品视频 | jizzjizz欧美69巨大| 久久人人爽人人爽人人片av免费 | 亚洲综合免费观看高清完整版在线 | 在线免费观看污 | 日本在线观看网站 | 亚洲人妻一区二区 | 中文字幕一区二区精品 | 99国产精品免费 | 国产一级视频免费观看 | 久久久永久久久人妻精品麻豆 | 神马久久久久久久久久久 | 欧美亚洲精品一区 | 亚洲a一区二区 | 日韩一级在线播放 | 日本色www | 欧美偷拍第一页 | 91网址在线播放 | 欧美成综合 | 欧美一区二区久久久 | 77777av| 日韩av线上 | 久操热| 久久97 | 日日日视频 | 成人夜夜 | 好吊色视频在线观看 | 欧美特级特黄aaaaaa在线看 | 久久桃色 | 国产66页| 成人激情自拍 | 国产天堂av在线 | 亚洲熟妇毛茸茸 | 韩国女主播一区二区 | 日批视频在线播放 | 男女作爱网站 | 精品精品精品 | 黄色一级淫片 | 亚洲天堂精品在线 | 成人福利视频网 | 少妇性l交大片免潘金莲 | 精品国产欧美一区二区 | 中文字幕亚洲专区 | 国产精品自拍偷拍视频 | 扒开伸进免费视频 | 色姑娘天天操 | 欧美成人精品一区二区三区 | 天天高潮夜夜爽 | 在线观看91av | 91国偷自产一区二区三区老熟女 | 亚洲成人一级片 | 九九热精品视频 | 91九色网站 | 亚洲精品一区二区三区精华液 | av男人的天堂在线 | 亚洲免费精品视频在线观看 | 亚洲精品视频在线观看免费 | 一区二区三区四区日韩 | 成人激情片 | 国产一区二区三区在线 | 日韩免费视频 | 亚洲无码久久久久久久 | 91天天操 | 一区二区三区四区国产 | 久久99久久99精品免观看软件 | 欧美成人免费在线 | 欧美xxxx黑人xyx性爽 | 精品日韩制服无码久久久久久 | 免费看一级| 91av免费在线观看 | 亚洲a一区二区 | 国精产品一区一区三区在线 | 亚洲永久免费 | 嫩草精品| 综合色网站 | 另类小说亚洲色图 | 午夜在线播放 | 在线看片黄 | 中文字幕码精品视频网站 | 成人网战| 亚洲va在线∨a天堂va欧美va | 69热在线观看 | 中文字幕亚洲专区 | 亚洲欧美偷拍视频 |