QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#13985. 数字平方系统

Estadísticas

Ponyo

波妞(Ponyo)在变成人类后,需要学习数学。她很快发现 $0$ 是看起来最无趣的数字。

因此,为了纪念她的朋友们——鱿鱼(squids),她创造了字符 <]:= 来代替 $0$。

因此,现在 $10$ 写作 1<]:=,而 $99 + 1$ 的结果写作 1<]:=<]:=

作为一项练习,请帮助波妞计算给定表达式的结果。请按照标准的运算顺序计算该表达式(乘除法优先于加减法,同级运算按从左到右的顺序进行)。

请注意,鉴于波妞的喜好,在输入表达式中,所有的 $0$ 都已被替换为 <]:=。因此,在你的输出中,也请将所有的 $0$ 替换为 <]:=

输入格式

输入包含两行。

第一行输入是一个单个整数 $n$ ($1 \le n \le 14$),表示表达式中的运算符数量。

第二行是一个表示数学表达式的字符串。该字符串由 $n + 1$ 个数字组成,每个数字之间由四个数学运算符 */+- 之一分隔。这里的 / 表示整数除法(即当整数相除时,结果向零取整)。保证数字和运算符之间有空格分隔。

这 $n + 1$ 个数字中的每一个都保证在 $1$ 到 $100$ 之间。它们由字符 19 组成,其中 0 被替换为符号 <]:=

所有计算均保证在 32 位有符号整数范围内。计算应遵循正确的运算顺序。输入中没有负数,但输出可能为负数。同时保证输入中不会出现除以零的情况。

输出格式

输出一行,包含一个整数 $x$,即表达式的结果。在这个数字 $x$ 中,请将所有的 $0$ 替换为 <]:=

样例

输入样例 1

1
1<]:= * 1<]:=

输出样例 1

1<]:=<]:=

输入样例 2

4
3 + 2<]:= / 1<]:= * 5 - 1<]:=

输出样例 2

3

输入样例 3

2
4<]:=4 - 8<]:= * 8

输出样例 3

-236

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.