QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 50

#13762. POT

Statistics

老师给她的学生们发了一封电子邮件,内容是以下任务:

“写一个程序,在给定以下等式的情况下,计算并输出 $X$ 的值:

$$X = \text{number}_1^{\text{pot}_1} + \text{number}_2^{\text{pot}_2} + \dots + \text{number}_N^{\text{pot}_N}$$

其中 $\text{number}_1, \text{number}_2$ 到 $\text{number}_N$ 是整数,而 $\text{pot}_1, \text{pot}_2$ 到 $\text{pot}_N$ 是一位数整数。”

不幸的是,当老师把任务下载到她的电脑上时,文本格式丢失了,因此任务变成了 $N$ 个整数的和:

$$X = P_1 + P_2 + \dots + P_N$$

例如,在没有文本格式的情况下,原本形式为 $X = 21^2 + 125^3$ 的任务变成了 $X = 212 + 1253$ 的形式。请通过编写一个程序来帮助老师,该程序在给定 $N$ 个整数 $P_1$ 到 $P_N$ 的情况下,计算并输出原始任务中 $X$ 的值。

请注意:我们知道 $a^N = a \cdot a \cdot \dots \cdot a$($N$ 次)。

输入格式

输入的第一行包含整数 $N$ ($1 \le N \le 10$),表示任务中加数的个数。

接下来的 $N$ 行,每行包含一个任务中的整数 $P_i$ ($10 \le P_i \le 9999, i = 1 \dots N$)。

输出格式

输出的第一行也是唯一的一行必须包含原始任务中 $X$ 的值 ($X \le 1\,000\,000\,000$)。

样例

输入格式 1

2
212
1253

输出格式 1

1953566

说明

第一个样例的解释:$21^2 + 125^3 = 441 + 1953125 = 1953566$。

输入格式 2

5
23
17
43
52
22

输出格式 2

102

输入格式 3

3
213
102
45

输出格式 3

10385

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.