QOJ.ac

QOJ

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

#22380. Coggle

Statistics

כמו כולם בחופשה, הפרות משחקות בגרסת הפרות של משחק המילים Boggle: Coggle. זהו משחק דומה שבו מטילים 25 קוביות אותיות למטריצה כזו:

           Z C C D X
           K Q M N B
           U O W Z Y
           F C O I J
           P A Q Z T

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

במטריצה לעיל, ה־"$C$" התחתון מאפשר ליצור "CAP", "COW" ו־"COOK", אך לא "COD" או "PACK". רשימת המילים המלאה מהמילון עבור הריבוע היא "CAP", "COOK", "COW", "OWN", "WIT", "WOO", "ZOO" ו־"ZOOM".

התוכנית צריכה לקרוא את המילון מ־dict.txt. הוא מסודר אלפביתית ומכיל פחות מ־25,000 מילים, כל אחת באורך עד 20 תווים. המילון עצמו מצורף ב־dict.txt וזמין בתיקיית העבודה בזמן השיפוט.

עזרו ל־Bessie לדעת כמה טוב תצליח. קראו חמש שורות של חמש אותיות המייצגות את הקוביות וספרו כמה מילים מהמילון אפשר ליצור. אין להשתמש באות של אותה קובייה פעמיים באותה מילה.

ספרו את המילים שאפשר ליצור. המספר עשוי להיות קטן ממספר דרכי היצירה, משום שמילה יכולה להיווצר בכמה דרכים.

קלט

  • שורות $1,\ldots,5$: שורה $i$ מכילה חמש אותיות גדולות מופרדות ברווחים, המייצגות את שורה $i$.

פלט

  • שורה $1$: מספר שלם אחד, מספר המילים מהמילון שניתן ליצור לפי הכללים המתוארים.

דוגמאות

קלט 1

Z C C D X
K Q M N B
U O W Z Y
F C O I J
P A Q Z T

פלט 1

8

מקור הבעיה: Traditional, 2009

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.