QOJ.ac

QOJ

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

#22824. Cowfix

Statistics

בדרך כלל ביטויים נכתבים בכתיב תוכי: פעולה בינארית בין אופרנדיה, כגון 1+2 או 7*(5-3). בכתיב תחילי היא לפניהם, כגון + 1 2 או * 7 - 5 3. בסופי היא אחריהם, כגון 1 2 + או 7 5 3 - *. תחילי וסופי אינם משתמשים בסוגריים.

פרות Farmer John מערבבות את שלושת הכתיבים. כותבות cowfix, עם מספרים בני ספרה אחת ופעולות בינאריות +, -. ניתן לפרש בכל ערבוב של כללי תוכי, תחילי וסופי. למשל +54+-82 מחושב לפחות בשתי דרכים:

+ 5 4 + - 8 2 = 9 + - 8 2 = 9 + 6 = 15
+ 5 4 + - 8 2 = + 9 - 8 2 = + 1 2 = 3

9-4+3 נותן גם $2$ וגם $8$. לביטוי cowfix נתון מצאו את מספר הערכים השונים האפשריים. מובטח שהקלט תקין תחבירית ב-cowfix.

קלט

מחרוזת אחת של לכל היותר 80 תווים ללא רווחים.

פלט

שורה אחת עם מספר הערכים השונים האפשריים.

דוגמאות

קלט 1

+54+-82

פלט 1

2

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.