QOJ.ac

QOJ

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

#22824. Cowfix

Statistics

Biểu thức thường viết trung tố: toán tử hai ngôi giữa toán hạng, như 1+2 hoặc 7*(5-3). Tiền tố đặt trước, như + 1 2 hoặc * 7 - 5 3. Hậu tố đặt sau, như 1 2 + hoặc 7 5 3 - *. Tiền tố và hậu tố không dùng ngoặc.

Bò của Farmer John thường trộn ba kiểu. Chúng viết cowfix bằng số một chữ số và toán tử hai ngôi +, -. Có thể diễn giải bằng bất kỳ hỗn hợp quy tắc trung tố, tiền tố, hậu tố. Ví dụ +54+-82 tính được ít nhất hai cách:

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

9-4+3 cho cả $2$ và $8$. Với biểu thức cowfix, tìm số giá trị khác nhau có thể nhận. Đầu vào bảo đảm hợp lệ cú pháp cowfix.

Dữ liệu vào

Một xâu tối đa 80 ký tự không có khoảng trắng.

Dữ liệu ra

Một dòng chứa số giá trị khác nhau có thể nhận.

Ví dụ

Dữ liệu vào 1

+54+-82

Dữ liệu ra 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.