CF1553A.Digits Sum

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Let's define S(x)S(x) to be the sum of digits of number xx written in decimal system. For example, S(5)=5S(5) = 5, S(10)=1S(10) = 1, S(322)=7S(322) = 7.

We will call an integer xx interesting if S(x+1)<S(x)S(x + 1) \lt S(x). In each test you will be given one integer nn. Your task is to calculate the number of integers xx such that 1≤x≤n1 \le x \le n and xx is interesting.

我们定义 S(x)S(x) 为十进制表示下数字 xx 的各位数字之和。例如,S(5)=5S(5) = 5,S(10)=1S(10) = 1,S(322)=7S(322) = 7。

若整数 xx 满足 S(x+1)<S(x)S(x + 1) \lt S(x),则称其为有趣的。在每组测试中,你将得到一个整数 nn。你的任务是计算满足 1≤x≤n1 \le x \le n 且 xx 是有趣的整数 xx 的个数。

输入格式

The first line contains one integer tt (1≤t≤10001 \le t \le 1000) — number of test cases.

Then tt lines follow, the ii-th line contains one integer nn (1≤n≤1091 \le n \le 10^9) for the ii-th test case.

第一行包含一个整数 tt(1≤t≤10001 \le t \le 1000)—— 测试用例的数量。

接下来有 tt 行,其中第 ii 行包含一个整数 nn(1≤n≤1091 \le n \le 10^9),表示第 ii 个测试用例的输入。

输出格式

Print tt integers, the ii-th should be the answer for the ii-th test case.

输出 tt 个整数,其中第 ii 个整数应为第 ii 个测试用例的答案。

输入输出样例

  • 输入#1

    5
    1
    9
    10
    34
    880055535

    输出#1

    0
    1
    1
    3
    88005553

说明/提示

The first interesting number is equal to 99.

第一个有趣的数等于 99。

输入解题思路,AI测评打分。不知道怎么写?

首页