QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 1024 MB 満点: 100

#23880. 桁和

統計

問題文

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

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

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

制約

  • $1 \le N \le 1\,000\,000$.
  • $N$ は整数である.

入力

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

N

出力

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

入出力例 1

入力

13

出力

4

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

入出力例 2

入力

20

出力

1

入出力例 3

入力

2019

出力

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.