QOJ.ac

QOJ

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

#22664. רבייה

Statistics

Farmer John מרבה את פרותיו. טכניקות מודרניות משתמשות בשוורים עטורי פרסים שמתו מזמן, ולכן אין צורך בשוורים. כמות המזון שולטת במספר העגלים; כל פרה מקבלת אותו מזון ומפיקה אותו מספר. הוא מתחיל בפרה אחת ורוצה $N$ אחרי כמה דורות.

אם $N = 12$, מאכיל את הראשונה כדי שתוליד שלושה עגלים. כשהדור הבא בוגר דיו, מאכיל כל פרה כדי שתוליד ארבעה, ובסוף שנים עשר. פרה נמכרת אחרי שהולידה, ולכן נשאר רק הדור האחרון.

בכל דור כל פרה מפיקה לפחות שני עגלים, בלי גבול עליון, כי הגזע חזק מאוד.

עבור המספר השלם $N$ ($1 \le N \le 2{,}000{,}000{,}000$), כמה דרכים שונות מביאות מפרה אחת ל־$N$ פרות? מספר הדרכים להשגת $N$ אינו עולה על $2{,}000{,}000{,}000$.

קלט

  • שורה 1: השלם $N$.

פלט

  • שורה 1: מספר הדרכים להשיג $N$ פרות.

דוגמאות

קלט 1

12

פלט 1

8

הסבר

הסבר הפלט

דרך לשנים עשר היא $(2,2,3)$: שני עגלים לפרה בדור הראשון, שניים בשני ושלושה בשלישי, בסך הכול שנים עשר עגלים צעירים. שבע האחרות הן $(2,3,2)$, $(3,2,2)$, $(3,4)$, $(4,3)$, $(12)$, $(2,6)$, $(6,2)$.

מחבר: Mihai Stroe, 2002

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.