QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 1024 MB Toplam puan: 100

#23880. Somma delle cifre

İstatistikler

Testo del problema

JOI-kun inizialmente aveva un certo intero compreso tra $1$ e $N$, inclusi. Dopo che JOI-kun ha eseguito la seguente operazione $0$ o più volte, l'intero in suo possesso è diventato $N$:

  • Sommare all'intero attualmente in suo possesso la somma delle cifre dell'intero stesso quando rappresentato in base $10$.

Dato $N$, scrivi un programma per trovare il numero di interi che JOI-kun avrebbe potuto avere inizialmente.

Vincoli

  • $1 \le N \le 1\,000\,000$.
  • $N$ è un intero.

Input

L'input viene fornito dallo standard input nel seguente formato:

N

Output

Stampa su $1$ riga il numero di interi che JOI-kun avrebbe potuto avere inizialmente.

Esempio 1

Input

13

Output

4

Ad esempio, se JOI-kun inizialmente aveva l'intero $5$ ed eseguiva l'operazione $3$ volte, il numero cambiava come $5 \to 10 \to 11 \to 13$. Ci sono solo $4$ interi che JOI-kun avrebbe potuto avere inizialmente: $5, 10, 11, 13$.

Esempio 2

Input

20

Output

1

Esempio 3

Input

2019

Output

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.