QOJ.ac

QOJ

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

#23880. סכום ספרות

Statistics

תיאור הבעיה

לג'וי-קון היה בהתחלה מספר שלם כלשהו בין $1$ ל-$N$ (כולל). לאחר שג'וי-קון ביצע את הפעולה הבאה $0$ פעמים או יותר, המספר השלם שהיה לו הפך ל-$N$:

  • להוסיף למספר השלם שברשותו את סכום הספרות של אותו מספר שלם כאשר הוא מיוצג בבסיס $10$.

בהינתן $N$, כתבו תוכנית המוצאת את מספר המספרים השלמים שיכלו להיות לג'וי-קון בהתחלה.

מגבלות

  • $1 \le N \le 1\,000\,000$.
  • $N$ הוא מספר שלם.

קלט

הקלט ניתן מהקלט הסטנדרטי בפורמט הבא:

N

פלט

הדפיסו בשורה $1$ את מספר המספרים השלמים שיכלו להיות לג'וי-קון בהתחלה.

דוגמה 1

קלט

13

פלט

4

לדוגמה, אם לג'וי-קון היה בהתחלה המספר השלם $5$ והוא ביצע את הפעולה $3$ פעמים, המספר השתנה כך: $5 \to 10 \to 11 \to 13$. ישנם רק $4$ מספרים שלמים שיכלו להיות לג'וי-קון בהתחלה: $5, 10, 11, 13$.

דוגמה 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.