日韩性视频-久久久蜜桃-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| 四虎午夜影院 | 日本免费网站视频 | 日本一区二区在线免费观看 | 亚洲v日本 | 国产精品一二区在线观看 | av桃色| 色综合天天综合网国产成人网 | 小色哥网站 | 欧美日韩成人精品 | 中韩毛片 | 欧美干 | 在线观看视频一区二区 | 国产精品自拍99 | 精品人妻久久久久一区二区三区 | 特级淫片裸体免费看 | 国产a级片免费看 | 影音先锋在线国产 | 国产综合婷婷 | 玖玖在线免费视频 | 成人精品黄段子 | 日韩性网 | 91精品国产一区二区三竹菊影视 | 亚洲国产综合网 | 国产在线免费视频 | 交专区videossex另类 | 夜夜操天天射 | 欧美日韩国产亚洲一区 | 色窝窝无码一区二区三区 | 毛片网站在线看 | 久久免费福利 | 夜夜躁日日躁狠狠久久av | www.狠狠操.com | 亚洲一区视频网站 | av电影在线不卡 | 一二三四av | 久久伊人中文字幕 | 国产毛片久久久久久国产毛片 | 精品一区二区三区精华液 | 男女洗澡互摸私密部位视频 | 激情女主播 | 日韩一级免费 | 免费人成网| 国产精品扒开腿做爽爽爽视频 | 欧美变态口味重另类 | 午夜67194| 99久久综合国产精品二区 | 欧洲亚洲一区二区 | 中国zzji女人高潮免费 | 超碰免费在线 | 色呦呦一区二区三区 | 无限资源日本好片 | 91麻豆影院| 青青操网 | www.爆操 | 免费在线小视频 | 日韩激情一区二区三区 | 蜜臀人妻四季av一区二区不卡 | 亚洲色图欧美另类 | 欧美精品亚洲精品 | 国产激情精品一区二区三区 | 在线看黄色网址 | 九七超碰在线 | 亚洲资源av | 91精品人妻一区二区 | 欧美精品黄色片 | 亚洲综合色小说 | 久久精品国产一区二区三区 | 免费爱爱视频 | 黄色大片视频网站 | 亚州国产精品视频 | 一级片在线免费看 | 日韩七区 | 午夜久久久久久噜噜噜噜 | av中文在线 | 天天射视频 | 欧美久久激情 | 麻豆爱爱视频 | 91大片免费看| 韩国在线不卡 | 黄色国产片 | 玖玖爱在线精品视频 | 亚洲成人7777 | 天天色婷婷 | 日韩精品在线一区 | 亚洲一区二区在线免费观看 | 新天堂在线 | 亚洲免费视频一区二区 | 被扒开腿一边憋尿一边惩罚 | 国产激情二区 | 久久青草视频 | 天天射天天干天天舔 | 黑人巨大精品欧美 | 先锋av资源网站 | 中日韩中文字幕一区二区 | 1000部拍拍拍18勿入免费视频 | 欧美aⅴ视频 | 久久理论视频 | 精品欧美 |