joj2748

来源:互联网 发布:意大利 玫瑰水 知乎 编辑:程序博客网 时间:2024/05/16 12:42

 2748: Pocket Money Plan


ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s65536K507249Standard

Jack is a plain child. When his mother gives his pocket money, he always plans how to spend within one week and more. This time, he thought of a new plan: he will spent one-tenth of his balance every day, if the money to spend this time is not an integer, it will be rounded up. Jack is not good at mathematics, so he thinks that it will be spent up after 10 days.

Last month, his mother gave Jack 100 dollars again. Jack was surprise that he was still rich for 28 days.

Jack needs your help: he would like to know how many days in this way that he will spend up all the money?

Input

The first line of the input gives the number N (N<100) of test cases. Each test case includes a positive integer A (0 < A < 100000000) in one line that identifies the number of pocket money.

Output

For each case, output the days to spend up the money in one line.

Sample Input

210100

Sample Output

1028

You can also read problem H in the PDF file below.

Plase click here to download.

Problem Source: skywind




#include<iostream>#include<stdio.h>#include<cmath>using namespace std;int main(){    int n;int m;    cin>>m;    for(int t=1;t<=m;t++)    {        scanf("%d",&n);        int days=0;        while(n>0)        {            if(n%10==0)            {                n=n-(n/10);            }            else            {                n=n-(n/10+1);            }            days++;        }        cout<<days<<endl;    }    return 0;}