QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 1024 MB 總分: 100

#23880. Digit Sum

统计

問題文

JOI 君は初めに $1$ 以上 $N$ 以下のある整数を持っていた.JOI 君は以下の操作を $0$ 回以上行ったところ,持っている整数が $N$ になった.

  • 持っている整数を十進法で表したときの各桁の和を,持っている整数に足す.

$N$ が与えられるので,JOI 君が初めに持っていた可能性のある整数の個数を求めるプログラムを作成せよ.

制約

  • $1 ≦ N ≦ 1 000 000$.
  • $N$ は整数である.

入力

入力は以下の形式で標準入力から与えられる.
$N$

出力

JOI 君が初めに持っていた可能性のある整数の個数を $1$ 行で出力せよ.

入出力例

入力例 1
13

出力例 1
4

  • 例えば JOI 君が初めに整数 $5$ を持っており,$3$ 回操作を行った場合 $5 → 10 → 11 → 13$ と変化する.JOI 君が初めに持っていた可能性のある整数は $5,10,11,13$ の $4$ 個のみである.

入力例 2
20

出力例 2
1


入力例 3
2019

出力例 3
449

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.