QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100

#23880. Tverrsum

Statistics

Oppgavebeskrivelse

JOI-kun hadde til å begynne med et bestemt heltall mellom $1$ og $N$, inkludert. Etter at JOI-kun utførte følgende operasjon $0$ eller flere ganger, ble heltallet han hadde lik $N$:

  • Legg til summen av sifrene i det nåværende heltallet (når det skrives i titallsystemet, base $10$) til det nåværende heltallet.

Gitt $N$, skriv et program som finner antallet heltall JOI-kun kan ha hatt til å begynne med.

Begrensninger

  • $1 \le N \le 1\,000\,000$.
  • $N$ er et heltall.

Inndata

Inndata gis fra standard inndata på følgende format:

N

Utdata

Skriv ut på $1$ linje antallet heltall JOI-kun kan ha hatt til å begynne med.

Eksempel 1

Inndata

13

Utdata

4

Hvis JOI-kun for eksempel hadde heltallet $5$ til å begynne med og utførte operasjonen $3$ ganger, endres det slik: $5 \to 10 \to 11 \to 13$. Det er bare $4$ heltall JOI-kun kan ha hatt til å begynne med: $5, 10, 11, 13$.

Eksempel 2

Inndata

20

Utdata

1

Eksempel 3

Inndata

2019

Utdata

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.