QOJ.ac

QOJ

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

#22824. Cowfix

Statistics

Ausdrücke stehen meist in Infixnotation: binärer Operator zwischen Operanden, wie 1+2 oder 7*(5-3). In Präfixnotation steht er davor, wie + 1 2 oder * 7 - 5 3. In Postfixnotation steht er danach, wie 1 2 + oder 7 5 3 - *. Präfix und Postfix brauchen keine Klammern.

Die Kühe von Farmer John mischen diese drei oft. Sie schreiben in cowfix mit einstelligen Zahlen und binären Operatoren + und -. Jede Mischung aus Infix-, Präfix- und Postfixregeln kann zur Interpretation dienen. Zum Beispiel lässt sich +54+-82 mindestens auf zwei Arten auswerten:

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

9-4+3 ergibt sowohl $2$ als auch $8$. Bestimmen Sie zu einem cowfix-Ausdruck die Anzahl verschiedener möglicher Werte. Die Eingabe ist garantiert syntaktisch gültiges cowfix.

Eingabe

Eine Zeichenkette mit höchstens 80 Zeichen ohne Leerzeichen.

Ausgabe

Eine Zeile mit der Anzahl verschiedener möglicher Werte.

Beispiele

Eingabe 1

+54+-82

Ausgabe 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.