joj2748

 2748: Pocket Money Plan


ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE
3s65536K507249Standard

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

2
10
100

Sample Output

10
28

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;
}




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值