QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓

#9932. 海棠与数学

统计

Haitang 定义正整数 $m$ 的 $S(m)$ 为 $m$ 的各位数字之和。 例如,$S(154) = 1 + 5 + 4 = 10$,$S(147) = 1 + 4 + 7 = 12$。 给定一个正整数 $n$,计算满足 $n \pmod m = S(m)$ 的正整数 $m \le n$ 的个数。

输入格式

每个测试包含多个测试用例。第一行包含一个整数 $T$ ($1 \le T \le 100$),表示测试用例的数量。接下来是各测试用例的描述。 每个测试用例仅包含一行,为一个整数 $n$ ($1 \le n \le 10^{12}$)。

输出格式

对于每个测试用例,输出一行,包含一个整数,即问题的答案。

样例

输入 1

8
11
45
14
191
9810
20061130
20080520
998244353

输出 1

1
3
0
3
17
10
3
15

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.