QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#23880. ผลรวมเลขโดด

الإحصائيات

โจทย์ปัญหา

ตอนแรก JOI-kun มีจำนวนเต็มจำนวนหนึ่งที่มีค่าตั้งแต่ $1$ ถึง $N$ เมื่อ JOI-kun ทำการดำเนินการต่อไปนี้ตั้งแต่ $0$ ครั้งขึ้นไป จำนวนเต็มที่เขามีอยู่ได้กลายเป็น $N$:

  • นำผลรวมของเลขโดดแต่ละหลักของจำนวนเต็มที่มีอยู่ในขณะนั้นเมื่อเขียนในระบบเลขฐาน $10$ มาบวกเข้ากับจำนวนเต็มที่มีอยู่ในขณะนั้น

เมื่อกำหนด $N$ มาให้ จงเขียนโปรแกรมเพื่อหาจำนวนของจำนวนเต็มที่ JOI-kun อาจจะมีอยู่ในตอนแรก

ข้อจำกัด

  • $1 \le N \le 1\,000\,000$
  • $N$ เป็นจำนวนเต็ม

ข้อมูลนำเข้า

ข้อมูลนำเข้าได้รับจากอินพุตมาตรฐานในรูปแบบต่อไปนี้:

N

ข้อมูลส่งออก

แสดงจำนวนของจำนวนเต็มที่ JOI-kun อาจจะมีอยู่ในตอนแรก ใน $1$ บรรทัด

ตัวอย่าง 1

ข้อมูลนำเข้า

13

ข้อมูลส่งออก

4

ตัวอย่างเช่น หากตอนแรก JOI-kun มีจำนวนเต็ม $5$ และทำการดำเนินการ $3$ ครั้ง ค่าจะเปลี่ยนแปลงเป็น $5 \to 10 \to 11 \to 13$ จำนวนเต็มที่ JOI-kun อาจจะมีอยู่ในตอนแรกมีเพียง $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.